<#assign renderStatus = false>
<#assign statusContent = ''>
<script type="text/javascript" src="./../script/page/config/tab_vol.js"></script>
<script>
    var processRemarker = false;
</script>
<div style="width:100%;position:absolute;top:0px;color:#122664;z-index:100">
<form id="searchForm" onSubmit="return false">
<!--判断是否存在流程节点-->
<#list query_field_list as queryField>
    <#if queryField.hidden?? && queryField.hidden=="1">
    <#else>
        <#if queryField.type?? && queryField.type != "3" && queryField.type != "15">
        <#else>
            <#assign renderStatus = true>
            <#assign statusContent = queryField.content>
        </#if>
    </#if>
</#list>

<!--数据流程节点-->
<#if renderStatus>
<div style="background-image:url(/PNPMS/theme/default/images/main/tabs_current.png);width:100%;height:26px;position:relative;padding-left:5px">${statusContent}</div>
<script>
    processRemarker = true;
</script>
</#if>

<!--搜索区域-->
<#assign hiddenItem=1>
<#if query_field_list?? && query_field_list?size gt 0>
    <#list query_field_list as queryField>
        <#if !queryField.hidden?? || queryField.hidden=="0">
            <#assign hiddenItem=0>
        </#if>
    </#list>
</#if>
<div style="display:none;">
    <input type="hidden" id="businessProcessId" name="businessProcess.id" value="${businessProcess.id}">
    <input type="hidden" id="listId" name="list.id" value="${list.id}">
    <input type="hidden" id="realListId" name="realList.id" <#if realList??>value="${realList.id}"</#if>>
    <input type="hidden" id="isInnerEdit" name="isInnerEdit" <#if isInnerEdit??>value="${isInnerEdit}"</#if>>
    <input type="hidden" id="id" name="id" <#if businessInstance?? && businessInstance.selectedIds?? && businessInstance.id??>value="${businessInstance.id}"<#else><#if filterMap['selectedIds.parentInstance.id']?? && filterMap['selectedIds.parentInstance.id'].filterValue??>value="${filterMap['selectedIds.parentInstance.id'].filterValue}"</#if></#if>>
    <input type="hidden" id="selectedIds" name="selectedIds" <#if businessInstance?? && businessInstance.selectedIds??>value="${businessInstance.selectedIds}"<#assign selectedIds=businessInstance.selectedIds><#else><#if filterMap['selectedIds']?? && filterMap['selectedIds'].filterValue??>value="${filterMap['selectedIds'].filterValue}"<#assign selectedIds=filterMap['selectedIds'].filterValue></#if></#if>>
<#if businessInstance?? && businessInstance.parentInstance?? && (!businessInstance.id?? || (businessProcess.businessObj.isChild?? && businessProcess.businessObj.isChild=="1"))>
    <input type="hidden" id="parentInstanceId" name="parentInstance.id" value="${businessInstance.parentInstance.id}">
</#if>
    <input type="hidden" id="linkOperate" name="linkOperate" <#if list.linkOperate??>value="${list.linkOperate}"</#if>>
    <input type="hidden" id="status" name="taskStatus">
    <input type="hidden" id="listTabItem" name="listTabItem.id">
    <input type="hidden" id="functionId" name="function.id" value="${function.id}">
</div>
<#if hiddenItem == 0>
<div id="queryForm" style="background-image:url(/PNPMS/theme/default/images/main/seach_area_bg.png);float:left;width:100%;height:32px;border:1px solid #96d0d2">
<div id="searchDiv" <#if filteritem_list??>style="position:absolute;float:left;display:none;z-index:5"<#else>style="position:absolute;float:left;z-index:5"</#if>>
    <table style="line-height:26px;*line-height:25px;">
        <tr>

            <#list query_field_list as queryField>
                <#if !queryField.hidden?? || queryField.hidden=="0">
                    <#if  queryField.type?? && queryField.type != "3" && queryField.type != "15">

                        <td class="textColor" style="padding-left:15px;">
                        ${queryField.field.displayName?default(queryField.field.desc)}：
                        </td>
                        <td class="elementColor">
                        ${queryField.content}
                        </td>
                    </#if>
                <#else>
                    <#if queryField.hidden?? && queryField.hidden=="1" && queryField.needAdvancedSearch?? && queryField.needAdvancedSearch=="1">
                    ${queryField.content}
                    </#if>
                </#if>
            </#list>

        </tr>
    </table>



</div>
</#if>

<div>
    <!-- 统计功能扩展开始-->
    <#if filterMap_linkOperate??>
        <input type="hidden" name="linkOperate" value="${filterMap_linkOperate}"/>
    </#if>
    <#if argsMap??>
        <#list argsMap?keys as key>
            <#if argsMap[key]?? && key!='linkOperate'>
                <input type="hidden"  name="filterMap['${key}'].filterValue" value='${"${"}argsMap["${key}"].filterValue${"?default(\"\")}"}' id="${key}" />
                <input type="hidden"  name="filterMap['${key}'].filterName" value='${"${"}argsMap["${key}"].filterName${"?default(\"\")}"}' />
                <input type="hidden"  name="filterMap['${key}'].expType" value='${"${"}argsMap["${key}"].expType${"?default(\"\")}"}' />
                <input type="hidden"  name="filterMap['${key}'].fieldId" value='${"${"}argsMap["${key}"].fieldId${"?default(\"\")}"}' />
                <#if argsMap[key].formatter??>
                    <input type="hidden"  name="filterMap['${key}'].formatter" value='${"${"}argsMap["${key}"].formatter${"?default(\"\")}"}' />
                </#if>
            </#if>
        </#list>
        <#if fromPage?? && fromPage.pageValues?? && fromPage.pageValues.cellID??>
            <input type="hidden"  name="cellID" value='${fromPage.pageValues.cellID}' id="cellID" />
        </#if>
    </#if>

<#list query_field_list as queryField>
	        <#if queryField.hidden?? && queryField.hidden=="1" && (!queryField.needAdvancedSearch?? || queryField.needAdvancedSearch=="0")>
${queryField.content}
</#if>
	    	</#list>
</div>
<div id="advancedSearchDiv" class="searchItem_div_class" style="<#if !filteritem_list??>display:none;<#else>padding-left: 65px;</#if>position:absolute;float:left;z-index:5">
<input type="hidden" id="searchLinkOperate" name="searchLinkOperate" value="${searchLinkOperate?default('')}">
<#if !filteritem_list??>
<table id="searchItem1" index="1" cellspacing="0" cellpadding="0" style="line-height:31px;*line-height:30px;_line-height:31px;">
    <tr>
        <td class="textColor" style="padding-left:15px">字段：</td>
        <td class="elementColor">
            <select onchange="changeSearchItemName('1')" onmouseover="FixWidth(this)" id="searchItemName1" style="width:110px" name="filterMap['field1'].filterName">
                <#list list.advancedSearchFieldList as field>
                    <#if field.type=='6' || field.type=='15' || field.type=='40' || field.type=='58' || field.type=='7' || field.type=='37' || field.type=='36'>
                        <option value="${field.name}.id">${field.displayName}</option>
                    <#else>
                        <option value="${field.name}">${field.displayName}</option>
                    </#if>
                </#list>
            </select>
        </td>
        <td class="textColor" style="padding-left:15px">查询方式：</td>
        <td class="elementColor">
            <select onchange="changeSearchItemFormatter('1')" style="width:110px" id="expType1" name="filterMap['field1'].expType">
                <option id="likeExpType1" value="LIKE">模糊匹配</option>
                <!--
                <option id="eqExpType1" value="EQ">等于</option>
                <option id="neExpType1" value="NE">不等于</option>
                <option id="gtExpType1" value="GT">大于</option>
                <option id="geExpType1" value="GE">大于等于</option>
                <option id="ltExpType1" value="LT">小于</option>
                <option id="leExpType1" value="LE">小于等于</option>
                -->
            </select>
            <input type="hidden" value="likeformatter" disabled="disabled" id="searchItemFormatter1" name="filterMap['field1'].formatter">
        </td>
        <td class="textColor" style="padding-left:15px">查询内容：</td>
        <td class="elementColor" id="searchItemContent1">
            <input type="text" maxlength="1000" name="filterMap['field1'].filterValue"/>
        </td>




    </tr>




</table>
<#else>
    <#assign index=1>
    <#list filteritem_list as item>
        <#if index == 1>
        <table id="searchItem${index}" index="${index}" cellspacing="0" cellpadding="0" style="line-height:31px;*line-height:30px;_line-height:31px;">
            <tr>
                <#if item.relation??>
                    <td class="elementColor">
                        <select style="width:50px;" class="keepsize" id="searchItemRelation${index}">
                            <option <#if item.relation=='&'>selected</#if> value="&">并且</option>
                            <option <#if item.relation=='|'>selected</#if> value="|">或者</option>
                        </select>
                    </td>
                </#if>

                <td class="textColor" style="padding-left:15px">字段：</td>

                <td class="elementColor">
                    <select onchange="changeSearchItemName('${index}')" onmouseover="FixWidth(this)" style="width:110px" id="searchItemName${index}" name="filterMap['field${index}'].filterName">
                        <#assign type='1'>
                        <#assign defaultValueType=''>
                        <#list list.advancedSearchFieldList as field>
                            <#if field.type=='6' || field.type=='15' || field.type=='40' || field.type=='58' || field.type=='7' || field.type=='37'|| field.type=='36'>
                                <#if field.name+'.id' == item.filterName>
                                    <#assign type=field.type>
                                    <#assign defaultValueType=field.defaultValueType?default('')>
                                    <option selected value="${field.name}.id">${field.displayName}</option>
                                <#else>
                                    <option value="${field.name}.id">${field.displayName}</option>
                                </#if>
                            <#else>
                                <#if field.name == item.filterName>
                                    <#assign type=field.type>
                                    <#assign defaultValueType=field.defaultValueType?default('')>
                                    <option selected value="${field.name}">${field.displayName}</option>
                                <#else>
                                    <option value="${field.name}">${field.displayName}</option>
                                </#if>
                            </#if>
                        </#list>
                    </select>
                </td>


                <td class="textColor" style="padding-left:15px">查询方式：</td>

                <td class="elementColor">
                    <select onchange="changeSearchItemFormatter('${index}')" style="width:110px" id="expType${index}" name="filterMap['field${index}'].expType">
                        <#if type=='4' || type== '10' || type=='63' || type=='62'  || type=='82' || type== '6' || type=='7' || type== '15' || type== '40' || type== '58'>
                            <#if type=='62'>
                                <option <#if item.expType=='LIKE'>selected</#if> id="likeExpType${index}" value="LIKE">模糊匹配</option>
                            <#else>
                                <option <#if item.expType=='EQ'>selected</#if> id="eqExpType${index}" value="EQ">等于</option>
                            </#if>
                        <#else>
                            <#if type!='3' && type!='35' && type!='65' && type!='66'>
                                <option <#if item.expType=='LIKE'>selected</#if> id="likeExpType${index}" value="LIKE">模糊匹配</option>
                            <#else>
	                            <option <#if item.expType=='EQ'>selected</#if> id="eqExpType${index}" value="EQ">等于</option>
	                            <option <#if item.expType=='NE'>selected</#if> id="neExpType${index}" value="NE">不等于</option>
	                            <option <#if item.expType=='GT'>selected</#if> id="gtExpType${index}" value="GT">大于</option>
	                            <option <#if item.expType=='GE'>selected</#if> id="geExpType${index}" value="GE">大于等于</option>
	                            <option <#if item.expType=='LT'>selected</#if> id="ltExpType${index}" value="LT">小于</option>
	                            <option <#if item.expType=='LE'>selected</#if> id="leExpType${index}" value="LE">小于等于</option>
                            </#if>
                        </#if>
                    </select>
                    <input type="hidden" value="${item.formatter?default('')}" id="searchItemFormatter${index}" name="filterMap['field${index}'].formatter">
                </td>


                <td class="textColor" style="padding-left:15px">查询内容：</td>


                <td class="elementColor" id="searchItemContent${index}">
                    <#if type=='3' || type== '35'>
                        <input type="text" class="Wdate" style="width:106px" onfocus="WdatePicker();" name="filterMap['field${index}'].filterValue" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"}/>
                    <#else>
                        <#if type=='4'>
                            <select name="filterMap['field${index}'].filterValue" onmouseover="FixWidth(this)" style="width:110px" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"}>
                            <option value=''>全部</option>
                            <option ${"<#if filterMap["}"${item.key}"${"]?? && filterMap["}"${item.key}"].filterValue=='1'${">"}selected="selected"${"</#if>"} value='1'>是</option>
                            <option ${"<#if filterMap["}"${item.key}"${"]?? && filterMap["}"${item.key}"].filterValue=='0'${">"}selected="selected"${"</#if>"} value='0'>否</option>
                            </select>
                        <#else>
                            <#if type=='10' || type=='63'  || type=='82' || type=='62'>
                                <select name="filterMap['field${index}'].filterValue" onmouseover="FixWidth(this)" style="width:110px" id="valueSelect${index}" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"}>
                                <option value=''>全部</option>
                                <#if item.valueObjectList?? && item.valueObjectList?size gt 0>
                                    <#list item.valueObjectList as valueObject>
                                        <option ${"<#if filterMap["}"${item.key}"${"]?? && filterMap["}"${item.key}"].filterValue=='${valueObject.value}'${">"}selected="selected"${"</#if>"} value='${valueObject.value}'>${valueObject.name}</option>
                                    </#list>
                                </#if>
                                </select>
                            <#else>
                                <#if type=='6' || type== '15' || type== '40' || type== '58' || type=='7' || type=='37'|| type=='36'>
                                    <input type="text" readonly="readonly" id="fieldCompany${index}" name="filterMap['companyName${index}'].filterValue" class="textTest" ${"<#if filterMap["}"companyName${index}"${"]??>"} value='${"${"}filterMap["companyName${index}"].filterValue?default('')${"}"}' ${"</#if>"} />
                                    <input type="hidden"  id="fieldCompanyId${index}"  name="filterMap['${item.key}'].filterValue" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"} />
                                    <#if type!='7'>
                                    <input type="hidden"  name="filterMap['${item.key}'].isCompanyQuery" value="1" />
                                    </#if>
                                    <div id="fieldDropdownMenu${index}" class="dropDD_contentDiv">
                                        <div style="overflow:auto;height:266px">
                                            <ul id="fieldCompanyTree${index}" class="tree"></ul>
                                        </div>
                                        <div class="buttonBox" style="position:absolute;bottom:0px;background:#f3f4f4;height:30px;padding-top:4px">
                                            <a href="javascript:void(0);" class="button" tabindex="-1"><input type="button" onclick="window.curDDWin.saveWin();return false;" value="确认"></a>
                                            <a href="javascript:void(0);" class="button" tabindex="-1"><input type="button" onclick="clearCompanySelect('${index}');return false;" value="清空"></a>
                                        </div>
                                    </div>
                                    <script>
                                        $(function(){
                                            var treeObject${index};
                                            var fieldSetting${index} = {
                                                <#if type=='7'>
                                                    asyncUrl : TDQS.CONTEXT_PATH+"region/alltree.action",
                                                <#else>
                                                    <#if type=='37'>
                                                        asyncUrl : TDQS.CONTEXT_PATH+"company/notLeafTree.action",
                                                    <#else>
                                                       	 <#if type=='36'>
                                                        	asyncUrl : TDQS.CONTEXT_PATH+"company/forPlanRecord.action",
                                                      	 <#else>
                                                    	  asyncUrl : TDQS.CONTEXT_PATH+"company/tree.action",
                                                   		 </#if>
                                                     </#if>
                                                </#if>
                                                asyncParam : ["id"],
                                                async : true,
                                                callback : {
                                                    click : function(event, treeId, treeNode) {
                                                        $(document.getElementById('fieldCompany${index}')).val(treeNode.name);
                                                        $(document.getElementById('fieldCompanyId${index}')).val(treeNode.id);
                                                        window.curDDWin.saveWin();
                                                    },
                                                    loadTreeSuccess : function(zTree, msg) {
                                                        treeObject${index} = zTree;
                                                        <#if type!='7'>
                                                            //zTree.expandAll();
                                                            var nodes = zTree.setting.root['nodes'];
                                                            for(var i=0;i<nodes.length;i++) {
                                                                zTree.expandNode(nodes[i],true,false);
                                                            }
                                                        </#if>
                                                    }
                                                }
                                            };
                                            $(document.getElementById('fieldCompany${index}')).inputStyle({
                                                operatorId:"companyMenuBtn${index}",
                                                operatorType:"text",
                                                operatorText:"选择",
                                                controllerWidth:108,
                                                operatorFun:function(){
                                                    if(!treeObject${index}) {
                                                        $("#fieldCompanyTree${index}").zTree(fieldSetting${index});
                                                    }
                                                    $("input[type='button']",$('.dropDD_contentDiv')).each(function(){
														this.style.backgroundImage="url(./../theme/default/images/main/btn_normal.png)";
														$(this).hover(function(){this.style.backgroundImage="url(./../theme/default/images/main/btn_over.png)";},function(){this.style.backgroundImage="url(./../theme/default/images/main/btn_normal.png)";});
													});
                                                    new DDWin({
                                                        el:"fieldDropdownMenu${index}"
                                                        ,dep:'divAround_fieldCompany${index}'
                                                        ,clickBody:'save'
                                                    });
                                                },
                                                imgFun:function(){
                                                    $(document.getElementById('fieldCompany${index}')).val("");
                                                    $(document.getElementById('fieldCompanyId${index}')).val("");
                                                    window.curDDWin.saveWin();
                                                }
                                            });
                                        });
                                    </script>
                                <#else>
                                    <input type="text" maxlength="1000" name="filterMap['field${index}'].filterValue" style="width:110px" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"} <#if type=='65'>class="Wdate" onfocus="WdatePicker({dateFmt:'yyyy年M月'});"<#else><#if type=='66'>class="Wdate" onfocus="WdatePicker({dateFmt:'yyyy'});"</#if></#if>/>
                                </#if>
                            </#if>
                        </#if>
                    </#if>
                </td>

                <#if index gt 1>
                    <td class="elementColor">
                        <div style="background-image:url(/PNPMS/theme/default/images/main/search/delete.png);width:20px;height:20px;cursor:pointer" onclick="removeSearchItem('${index}')" title="删除"/>
                    </td>
                </#if>
            </tr>

        </table>
            <#assign index=index+1>
        </#if>
    </#list>
</#if>

</div>

<!-- 统计功能扩展结束 -->
<#if hiddenItem == 0>
<div id="search_button" style="position:relative;float:right;top:0px;right:0px">
    <table cellspacing="0" cellpadding="0">
        <tr>

            <td>
                <div class="searchButtonBox buttonsDiv" style="width:320px">

                    <a href="#" class="button" tabindex="-1">
                        <div style="<#if !filteritem_list??>display:none;</#if>position:relative;float:right;border-left:1px solid #96d0d2;border-right:1px solid #96d0d2;">
                            <img id="commonSearch_img" src="./../theme/default/images/main/search/normal.png" <#if !filteritem_list??>style="display:none;position:absolute;top:6px"<#else>style="position:absolute;top:6px"</#if>>
                            <input id="commonSearch" <#if !filteritem_list??>style="display:none;margin-top:0px;width:100px"<#else>style="margin-top:0px;width:100px"</#if> type="button" value="普通查询" onClick="">
                        </div>
                    </a>
                    <a href="#" class="button" tabindex="-1">
                        <div style="<#if !filteritem_list??>display:none;</#if>position:relative;float:right;border-left:1px solid #96d0d2">
                            <img id="addSearchItem_img" src="./../theme/default/images/main/search/add.png" <#if !filteritem_list??>style="display:none;position:absolute;top:6px"<#else>style="position:absolute;top:6px"</#if>>
                            <input id="addSearchItem" <#if !filteritem_list??>style="display:none;margin-top:0px;width:100px"<#else>style="margin-top:0px;width:100px"</#if> type="button" value="添加条件" onClick="">
                        </div>
                    </a>
                    <a href="#" class="button" tabindex="-1">
                        <div style="<#if filteritem_list??>display:none;</#if>position:relative;float:right;border-left:1px solid #96d0d2;border-right:1px solid #96d0d2;">
                            <img id="advancedSearch_img" src="./../theme/default/images/main/search/advanced.png" <#if filteritem_list??>style="display:none;position:absolute;top:6px"<#else>style="position:absolute;top:6px"</#if>>
                            <#if list.advancedSearchFieldList?? && list.advancedSearchFieldList?size gt 0>
                            <input id="advancedSearch" <#if filteritem_list??>style="display:none;margin-top:0px;width:100px"<#else>style="margin-top:0px;width:100px"</#if> type="button" value="高级查询" onClick="">
                        	</#if>
                        </div>
                    </a>
                    <a href="#" class="button" tabindex="-1">
                        <div style="position:relative;float:right;border-left:1px solid #96d0d2;">
                            <img id="search_img" src="./../theme/default/images/main/search/search.png" style="position:absolute;top:6px">
                            <input id="search" type="button" style="margin-top:0px" value="查询" onClick="">
                        </div>
                    </a>
                    <a href='javascript:void(0);' class="button switchOpen" id="search_condition_switch" tabindex="-1" onclick="switchCondition(this)" style="<#if !filteritem_list?? || filteritem_list?size lt 2>display:none;</#if>">
                        <div style="<#if filteritem_list?? && filteritem_list?size gt 1>border-left:1px solid #96d0d2;</#if>position:relative;float:right;cursor:pointer;">
                            <img id="search_switch_a_img" src="./../theme/default/images/main/search/search_switch_open_normal.png" style="position:absolute;top:6px">
                            <input type="button" style="margin-top:0px;width:16px;" onClick="">
                        </div>
                    </a>





                </div>

            </td>
        </tr>

    </table>
</div>


</div>
</#if>
<#if filteritem_list??>
    <#assign index=1>
    <#list filteritem_list as item>
        <#if index gt 1>
        <div id="searchItem_div${index}" class="searchItem_div_class" style='position: relative; float: left; background-image: url("/PNPMS/theme/default/images/main/seach_area_bg.png"); width: 100%; height: 32px; border-left:1px solid #96d0d2;border-right:1px solid #96d0d2;border-bottom:1px solid #96d0d2;padding-left: 15px;'>
            <table id="searchItem${index}" index="${index}" cellspacing="0" cellpadding="0" style="line-height:31px;*line-height:30px;_line-height:31px;">
                <tr>
                    <#if item.relation??>
                        <td class="elementColor">
                            <select style="width:50px;" class="keepsize" id="searchItemRelation${index}">
                                <option <#if item.relation=='&'>selected</#if> value="&">并且</option>
                                <option <#if item.relation=='|'>selected</#if> value="|">或者</option>
                            </select>
                        </td>
                    </#if>

                    <td class="textColor" style="padding-left:15px">字段：</td>

                    <td class="elementColor">
                        <select onchange="changeSearchItemName('${index}')" onmouseover="FixWidth(this)" style="width:110px" id="searchItemName${index}" name="filterMap['field${index}'].filterName">
                            <#assign type='1'>
                            <#assign defaultValueType=''>
                            <#list list.advancedSearchFieldList as field>
                                <#if field.type=='6' || field.type=='15' || field.type=='40' || field.type=='58' || field.type=='7' || field.type=='37'|| field.type=='36'>
                                    <#if field.name+'.id' == item.filterName>
                                        <#assign type=field.type>
                                        <#assign defaultValueType=field.defaultValueType?default('')>
                                        <option selected value="${field.name}.id">${field.displayName}</option>
                                    <#else>
                                        <option value="${field.name}.id">${field.displayName}</option>
                                    </#if>
                                <#else>
                                    <#if field.name == item.filterName>
                                        <#assign type=field.type>
                                        <#assign defaultValueType=field.defaultValueType?default('')>
                                        <option selected value="${field.name}">${field.displayName}</option>
                                    <#else>
                                        <option value="${field.name}">${field.displayName}</option>
                                    </#if>
                                </#if>
                            </#list>
                        </select>
                    </td>


                    <td class="textColor" style="padding-left:15px">查询方式：</td>

                    <td class="elementColor">
                        <select onchange="changeSearchItemFormatter('${index}')" style="width:110px" id="expType${index}" name="filterMap['field${index}'].expType">
                            <#if type=='4' || type== '10' || type=='63' || type=='62' || type=='82' || type== '6' || type== '15' || type== '40' || type== '58' || type=='7'>
                                <#if type=='62'>
                                    <option <#if item.expType=='LIKE'>selected</#if> id="likeExpType${index}" value="LIKE">模糊匹配</option>
                                <#else>
                                    <option <#if item.expType=='EQ'>selected</#if> id="eqExpType${index}" value="EQ">等于</option>
                                </#if>
                            <#else>
                                <#if type!='3' && type!='35' && type!='65' && type!='66'>
                                    <option <#if item.expType=='LIKE'>selected</#if> id="likeExpType${index}" value="LIKE">模糊匹配</option>
                                <#else>
	                                <option <#if item.expType=='EQ'>selected</#if> id="eqExpType${index}" value="EQ">等于</option>
	                                <option <#if item.expType=='NE'>selected</#if> id="neExpType${index}" value="NE">不等于</option>
	                                <option <#if item.expType=='GT'>selected</#if> id="gtExpType${index}" value="GT">大于</option>
	                                <option <#if item.expType=='GE'>selected</#if> id="geExpType${index}" value="GE">大于等于</option>
	                                <option <#if item.expType=='LT'>selected</#if> id="ltExpType${index}" value="LT">小于</option>
	                                <option <#if item.expType=='LE'>selected</#if> id="leExpType${index}" value="LE">小于等于</option>
                                </#if>
                            </#if>
                        </select>
                        <input type="hidden" value="${item.formatter?default('')}" id="searchItemFormatter${index}" name="filterMap['field${index}'].formatter">
                    </td>


                    <td class="textColor" style="padding-left:15px">查询内容：</td>


                    <td class="elementColor" id="searchItemContent${index}">
                        <#if type=='3' || type== '35'>
                            <input type="text" class="Wdate" style="width:106px" onfocus="WdatePicker();" name="filterMap['field${index}'].filterValue" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"}/>
                        <#else>
                            <#if type=='4'>
                                <select name="filterMap['field${index}'].filterValue" onmouseover="FixWidth(this)" style="width:110px" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"}>
                                <option value=''>全部</option>
                                <option ${"<#if filterMap["}"${item.key}"${"]?? && filterMap["}"${item.key}"].filterValue=='1'${">"}selected="selected"${"</#if>"} value='1'>是</option>
                                <option ${"<#if filterMap["}"${item.key}"${"]?? && filterMap["}"${item.key}"].filterValue=='0'${">"}selected="selected"${"</#if>"} value='0'>否</option>
                                </select>
                            <#else>
                                <#if type=='10' || type=='63'  || type=='82' || type=='62'>
                                    <select name="filterMap['field${index}'].filterValue" onmouseover="FixWidth(this)" style="width:110px" id="valueSelect${index}" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"}>
                                    <option value=''>全部</option>
                                    <#if item.valueObjectList?? && item.valueObjectList?size gt 0>
                                        <#list item.valueObjectList as valueObject>
                                            <option ${"<#if filterMap["}"${item.key}"${"]?? && filterMap["}"${item.key}"].filterValue=='${valueObject.value}'${">"}selected="selected"${"</#if>"} value='${valueObject.value}'>${valueObject.name}</option>
                                        </#list>
                                    </#if>
                                    </select>
                                <#else>
                                    <#if type=='6' || type== '15' || type== '40' || type== '58' || type=='7' || type=='37' || type=='36'>
                                        <input type="text" readonly="readonly" id="fieldCompany${index}" name="filterMap['companyName${index}'].filterValue" class="textTest" ${"<#if filterMap["}"companyName${index}"${"]??>"} value='${"${"}filterMap["companyName${index}"].filterValue?default('')${"}"}' ${"</#if>"} />
                                        <input type="hidden"  id="fieldCompanyId${index}"  name="filterMap['${item.key}'].filterValue" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"} />
                                        <#if type!='7'>
	                                    <input type="hidden"  name="filterMap['${item.key}'].isCompanyQuery" value="1" />
	                                    </#if>
                                        <div id="fieldDropdownMenu${index}" class="dropDD_contentDiv">
                                            <div style="overflow:auto;height:266px">
                                                <ul id="fieldCompanyTree${index}" class="tree"></ul>
                                            </div>
                                            <div class="buttonBox" style="position:absolute;bottom:0px;background:#f3f4f4;height:30px;padding-top:4px">
                                                <a href="javascript:void(0);" class="button" tabindex="-1"><input type="button" onclick="window.curDDWin.saveWin();return false;" value="确认"></a>
                                                <a href="javascript:void(0);" class="button" tabindex="-1"><input type="button" onclick="clearCompanySelect('${index}');return false;" value="清空"></a>
                                            </div>
                                        </div>
                                        <script>
                                            $(function(){
                                                var url = TDQS.CONTEXT_PATH+"company/tree.action";
                                                 <#if type=='37'>
                                                    url = TDQS.CONTEXT_PATH+"company/notLeafTree.action";
                                                 </#if>
                                                 <#if type=='36'>
                                                    url = TDQS.CONTEXT_PATH+"company/forPlanRecord.action";
                                                 </#if>
                                                var treeObject${index};
                                                var fieldSetting${index} = {
                                                    asyncUrl : url,
                                                    asyncParam : ["id"],
                                                    async : true,
                                                    callback : {
                                                        click : function(event, treeId, treeNode) {
                                                            $(document.getElementById('fieldCompany${index}')).val(treeNode.name);
                                                            $(document.getElementById('fieldCompanyId${index}')).val(treeNode.id);
                                                            window.curDDWin.saveWin();
                                                        },
                                                        loadTreeSuccess : function(zTree, msg) {
                                                            //zTree.expandAll();
                                                            treeObject${index} = zTree;
                                                            var nodes = zTree.setting.root['nodes'];
                                                            for(var i=0;i<nodes.length;i++) {
                                                                zTree.expandNode(nodes[i],true,false);
                                                            }
                                                        }
                                                    }
                                                };
                                                <#if type=='7'>
                                                    url = TDQS.CONTEXT_PATH+"region/alltree.action";
                                                    fieldSetting${index} = {
                                                        asyncUrl : url,
                                                        asyncParam : ["id"],
                                                        async : true,
                                                        callback : {
                                                            click : function(event, treeId, treeNode) {
                                                                $(document.getElementById('fieldCompany${index}')).val(treeNode.name);
                                                                $(document.getElementById('fieldCompanyId${index}')).val(treeNode.id);
                                                                window.curDDWin.saveWin();
                                                            },
                                                            loadTreeSuccess : function(zTree, msg) {
                                                                treeObject${index} = zTree;
                                                            }
                                                        }
                                                    };
                                                </#if>
                                                $(document.getElementById('fieldCompany${index}')).inputStyle({
                                                    operatorId:"companyMenuBtn${index}",
                                                    operatorType:"text",
                                                    operatorText:"选择",
                                                    controllerWidth:108,
                                                    operatorFun:function(){
                                                        if(!treeObject${index}) {
                                                            $("#fieldCompanyTree${index}").zTree(fieldSetting${index});
                                                        }
                                                        $("input[type='button']",$('.dropDD_contentDiv')).each(function(){
															this.style.backgroundImage="url(./../theme/default/images/main/btn_normal.png)";
															$(this).hover(function(){this.style.backgroundImage="url(./../theme/default/images/main/btn_over.png)";},function(){this.style.backgroundImage="url(./../theme/default/images/main/btn_normal.png)";});
														});
                                                        new DDWin({
                                                            el:"fieldDropdownMenu${index}"
                                                            ,dep:'divAround_fieldCompany${index}'
                                                            ,clickBody:'save'
                                                        });
                                                    },
                                                    imgFun:function(){
                                                        $(document.getElementById('fieldCompany${index}')).val("");
                                                        $(document.getElementById('fieldCompanyId${index}')).val("");
                                                        window.curDDWin.saveWin();
                                                    }
                                                });
                                            });
                                        </script>
                                    <#else>
                                        <input type="text" maxlength="1000" name="filterMap['field${index}'].filterValue" ${"<#if filterMap["}"${item.key}"${"]??>"} value='${"${"}filterMap["${item.key}"].filterValue?default('')${"}"}' ${"</#if>"} <#if type=='65'>class="Wdate" onfocus="WdatePicker({dateFmt:'yyyy年M月'});"<#else><#if type=='66'>class="Wdate" onfocus="WdatePicker({dateFmt:'yyyy'});"</#if></#if>/>
                                    </#if>
                                </#if>
                            </#if>
                        </#if>
                    </td>

                    <#if index gt 1>
                        <td class="elementColor">
                            <div class="searchButtonBox" style="width:20px;padding-left:10px">
                                <a href='javascript:void(0);' class="button switchOpen" tabindex="-1" onclick="removeSearchItem('${index}')" title="删除">
                                    <div style="border-left:1px solid #96d0d2;border-right:1px solid #96d0d2;position:relative;float:right;cursor:pointer;">
                                        <img id="search_switch_a_img" src="./../theme/default/images/main/search/delete.png" style="position:absolute;top:6px">
                                        <input type="button" style="margin-top:0px;width:16px;">
                                    </div>
                                </a>
                            </div>
                        </td>
                    </#if>
                </tr>

            </table>
        </div>
        </#if>
        <#assign index=index+1>
    </#list>
</#if>
</form>
</div>

<!--数据列表区域-->
<div class="center_all_div" style="height:100%;">
    <div class="center_n" style="background-image: url(./../theme/default/images/main/pane_top.png)"></div>
    <div class="center_c" style="height:100%;padding:0px">
        <div class="center_c_n">

        <#if realList.tab?? && realList.tab.itemList?size gt 0>
            <div style="position:relative;float:left;clear:left:top:0px;left:5px;line-height:25px;line-height:30px\9;z-index:1000">
                <#if filterMap['list_selected_tab']?? && filterMap['list_selected_tab'].filterValue??>
                    <#assign selectTabValue = filterMap['list_selected_tab'].filterValue>
                </#if>
               
                <!--切换列表的图标-->
                <#if switchLists?? && switchLists?size gt 0>
                	<#assign switchOperation=0>
		            <div style="margin-bottom:5px;text-align:center;float:center;position:relative;">
		                <#assign showOrigList=0>
		                <#list list.companyLists as companyList>
		                    <#if companyList.id==realList.id>
		                        <#assign showOrigList=1>
		                    </#if>
		                </#list>
		                <#if list.id==realList.id || showOrigList==1>
		                    <#list switchLists as switchList>
		                    	<#if switchList.desc?? && switchList.desc == "项目前期费用信息表">
		                    		<img src="./../theme/default/images/main/list_free.png" onclick="switchList('${switchList.id}');return false;" title="${switchList.desc?default('')}" style="cursor:pointer;"/>&nbsp;&nbsp;
		                    	<#else>
		                    		<img src="./../theme/default/images/main/list_node.png" onclick="switchList('${switchList.id}');return false;" title="${switchList.desc?default('')}" style="cursor:pointer;"/>&nbsp;&nbsp;
		                    	</#if>
		                    </#list>
		                <#else>
		                	<#if companyRealList.desc?? && companyRealList.desc == "项目前期费用信息表">
		                    	<img src="./../theme/default/images/main/list_free.png" onclick="switchList('${companyRealList.id}');return false;" title="${companyRealList.desc?default('')}" style="cursor:pointer;"/>&nbsp;&nbsp;
		                    <#else>
		                    	<img src="./../theme/default/images/main/list_node.png" onclick="switchList('${companyRealList.id}');return false;" title="${companyRealList.desc?default('')}" style="cursor:pointer;"/>&nbsp;&nbsp;
		                    </#if>
		                    <#list switchLists as switchList>
		                        <#if switchList.id!=realList.id>
		                        	<#if switchList.desc?? && switchList.desc == "项目前期费用信息表">
		                        		<img src="./../theme/default/images/main/list_free.png" onclick="switchList('${switchList.id}');return false;" title="${switchList.desc?default('')}" style="cursor:pointer;"/>&nbsp;&nbsp;
		                        	<#else>
		                        		<img src="./../theme/default/images/main/list_node.png" onclick="switchList('${switchList.id}');return false;" title="${switchList.desc?default('')}" style="cursor:pointer;"/>&nbsp;&nbsp;
		                        	</#if>
		                        </#if>
		                    </#list>
		                </#if>
		            </div>
		       </#if>
               <!--end-->
                
                
                <#if tab_item_list??>
						<#if switchOperation?? && switchOperation==0>
                    		<div class="ui-tabs ui-widget ui-widget-content" style="position:absolute;top:0px;_top:3px;padding:0px;left:23px;border:0px;overflow:hidden;width:630px">
                    	<#else>
                    		<div class="ui-tabs ui-widget ui-widget-content" style="position:absolute;top:0px;_top:3px;padding:0px;border:0px;overflow:hidden;width:630px">
                    	</#if>
                        <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header">
                            <#list tab_item_list as item>
                                <li id="${item.id}" <#if item_index == 0> class="ui-state-default ui-state-active tab_selected selectedTab" style='<#else> class="ui-state-default" style='</#if> display:inline;cursor:pointer;font-size:12px;font-weight: bold; color: #122664;border-bottom:0'>
                                <#if item_index == 0>
                                    <div class="leftBorder" style="font-size: 1px;position:relative;background-image:url('./../theme/default/images/main/tab_left_down.png');float:left;left:0px;width:3px;height:26px"></div>
                                    <div class="contentInner"  style="padding: 0px;line-height:14px;height:25px;position:relative;float:left;border-top:1px solid #2b729a;background-image:url('./../theme/default/images/main/tabs_down.png');">
                                        <a href="javascript:void(0)" onclick="changeTab('${item.id}');return false;" style="margin-top:0px;padding-left:2px;padding-right:2px;"><span style="cursor:pointer;" >${item.title}</span></a>
                                    </div>
                                    <div class="rightBorder" style="font-size: 1px;position:relative;background-image:url('./../theme/default/images/main/tab_right_down.png');float:left;right:0px;width:3px;height:26px">&nbsp;&nbsp;&nbsp;</div>
                                <#else>
                                    <div class="leftBorder" style="font-size: 1px;position:relative;float:left;background-image:url('./../theme/default/images/main/tab_left.png');left:0px;width:3px;height:26px"></div>
                                    <div class="contentInner"  style="padding: 0px;line-height:14px;height:25px;position:relative;float:left;border-top:1px solid #c2e2eb;background-image:url('./../theme/default/images/main/tabs.png');">
                                        <a href="javascript:void(0)" onclick="changeTab('${item.id}');return false;" style="margin-top:0px;padding-left:2px;padding-right:2px;"><span style="cursor:pointer;" >${item.title}</span></a>
                                    </div>
                                    <div class="rightBorder" style="font-size: 1px;position:relative;background-image:url('./../theme/default/images/main/tab_right.png');float:left;right:0px;width:3px;height:26px">&nbsp;&nbsp;&nbsp;</div>
                                </#if>
                                </li>
                            </#list>
                        </ul>
                    </div>

                </#if>
            </div>
        <#else>
            <div id="listTitle" style="position:relative;float:left;clear:left:top:0px;left:5px;font-size:12px;color:#307096;z-index:800;line-height:25px;line-height:30px\9">
            ${list.name}
            </div>
        </#if>
            <div class="toolbar">
                <ul class="program_toolbar" id="mainButton">
                <#list common_func_list?reverse as comFunc>
                    <#if comFunc.function?? && comFunc.function.forwardToImportFile?? && comFunc.function.forwardToImportFile.templateUrl??>
                        <#assign templateUrl=comFunc.function.forwardToImportFile.templateUrl>
                    </#if>
                    <#assign show="0">
                    <#list feature_list as feature>
                        <#if comFunc.function.name==feature.code>
                            <#assign show="1">
                        </#if>
                    </#list>
                    <#if show?? && show=="1">
                        <#if comFunc.function.icon??>
                            <#if comFunc.function.url??>
                                <li class="${comFunc.function.icon}" style="cursor:pointer;" onclick="javascript:showUrl('${comFunc.function.url}');return false;"><a href="javascript:void(0)"><img src="./../theme/default/images/main/blank.gif" style="float:left;clear:left"><div style="line-height:20px;line-height:23px\9;float:left;cursor:pointer"><span style="cursor:pointer">${comFunc.function.displayName?default('')}</span></div></a></li>
                            <#else>
                                <#if comFunc.function.isFunctionGroup?? && comFunc.function.isFunctionGroup=="1">
                                    <li class="${comFunc.function.icon}" style="cursor:pointer;border-right:1px solid #edfbfe;border-left:1px solid #edfbfe;border-top:1px solid #edfbfe;" onmouseover="javascript:showFunctionGroup(this,$('a div span',this),'${comFunc.function.id}',event);return false;"><a href="javascript:void(0)" ><img src="./../theme/default/images/main/blank.gif" style="float:left;clear:left"><div style="line-height:20px;line-height:23px\9;float:left;cursor:pointer"><span style="cursor:pointer;">${comFunc.function.displayName?default('')}</span></div></a></li>
                                    <div id="div${comFunc.function.id}" class="functionGroup" style="display:none;position:relative;float:left;clear:left">
                                        <ul style="list-style:none;line-height:25px;">
                                            <#list common_func_list?reverse as commonFunc>
                                                <#assign show="0">
                                                <#list feature_list as feature>
                                                    <#if commonFunc.function.name==feature.code>
                                                        <#assign show="1">
                                                    </#if>
                                                </#list>
                                                <#if show?? && show=="1" && commonFunc.function.parentFunction?? && commonFunc.function.parentFunction.id == comFunc.function.id>
                                                    <li class="${commonFunc.function.icon}" style="cursor:pointer;margin: 0px;padding: 0px;" onmouseover="processOver(this);" onmouseout="processOut(this);" onclick="javascript:processCommonFunc('${commonFunc.function.id}',<#if commonFunc.isBatch??>'${commonFunc.isBatch}'<#else>'0'</#if>,<#if commonFunc.function.messageType??>'${commonFunc.function.messageType}'<#else>'0'</#if>,<#if commonFunc.function.message??>'${commonFunc.function.message}'<#else>''</#if>,<#if commonFunc.function.forwardType??>'${commonFunc.function.forwardType}'<#else>''</#if>,<#if commonFunc.function.clearSession??>'${commonFunc.function.clearSession}'<#else>'0'</#if>,<#if commonFunc.function.isPassParams??>'${commonFunc.function.isPassParams}'<#else>'0'</#if>);return false;"><a href="javascript:void(0)"><span style="cursor:pointer;margin-left:10px">${commonFunc.function.displayName?default('')}</span></a></li>
                                                </#if>
                                            </#list>
                                        </ul>
                                    </div>
                                <#else>
                                    <#if  !comFunc.function.parentFunction??>
                                        <#if selectedIds??>
                                            <#if comFunc.function?? && comFunc.function.displayName?? && comFunc.function.displayName=='返回'>
                                                <li class="${comFunc.function.icon}" style="cursor:pointer" onclick="javascript:processCommonFunc('${comFunc.function.id}',<#if comFunc.isBatch??>'${comFunc.isBatch}'<#else>'0'</#if>,<#if comFunc.function.messageType??>'${comFunc.function.messageType}'<#else>'0'</#if>,<#if comFunc.function.message??>'${comFunc.function.message}'<#else>''</#if>,<#if comFunc.function.forwardType??>'${comFunc.function.forwardType}'<#else>''</#if>,<#if comFunc.function.clearSession??>'${comFunc.function.clearSession}'<#else>'0'</#if>,<#if comFunc.function.isPassParams??>'${comFunc.function.isPassParams}'<#else>'0'</#if>);return false;"><a href="javascript:void(0)"><img src="./../theme/default/images/main/blank.gif" style="float:left;clear:left"><div style="line-height:20px;line-height:23px\9;float:left;cursor:pointer"><span style="cursor:pointer">${comFunc.function.displayName?default('')}</span></div></a></li>
                                            </#if>
                                        <#else>
                                            <li class="${comFunc.function.icon}" style="cursor:pointer" onclick="javascript:processCommonFunc('${comFunc.function.id}',<#if comFunc.isBatch??>'${comFunc.isBatch}'<#else>'0'</#if>,<#if comFunc.function.messageType??>'${comFunc.function.messageType}'<#else>'0'</#if>,<#if comFunc.function.message??>'${comFunc.function.message}'<#else>''</#if>,<#if comFunc.function.forwardType??>'${comFunc.function.forwardType}'<#else>''</#if>,<#if comFunc.function.clearSession??>'${comFunc.function.clearSession}'<#else>'0'</#if>,<#if comFunc.function.isPassParams??>'${comFunc.function.isPassParams}'<#else>'0'</#if>);return false;"><a href="javascript:void(0)"><img src="./../theme/default/images/main/blank.gif" style="float:left;clear:left"><div style="line-height:20px;line-height:23px\9;float:left;cursor:pointer"><span style="cursor:pointer">${comFunc.function.displayName?default('')}</span></div></a></li>
                                        </#if>
                                    </#if>
                                </#if>
                            </#if>
                        <#else>
                            <li class="t8" style="cursor:pointer"><a href="javascript:void(0);"><img src="./../theme/default/images/main/blank.gif" onclick=""><br/></a></li>
                        </#if>
                    </#if>
                </#list>
                </ul>
            </div>
        </div>
        <div class="center_c_c" style="padding:0px">
            <!--jquery validator显示错误信息的容器 -->
            <div class="serverErrorContainer" style="position:relative;">
                <div class="serverError">
                    <ol>

                    </ol>
                </div>

                <div class="container">
                    <div class="searchButtonBox handleDiv" onclick="displayTable('handleDiv')">
                        <a href='javascript:void(0);' class="button switchOpen"  tabindex="-1" >
                            <div style="border:1px solid #96d0d2;border-bottom:0px;position:relative;float:right;cursor:pointer;">
                                <img id="handleDiv" src="./../theme/default/images/main/search/search_switch_open_normal.png" style="position:absolute;top:6px">
                                <input type="button" style="margin-top:0px;width:16px;">
                            </div>
                        </a>
                    </div>
                    <div id="handleDiv_child" class="errorDIv" divAttend="attend">
                        <ol>
                        </ol>
                    </div>
                </div>
            </div>
            <!-- end -->
            <div style="height:1px;font-size:1px">
                <span>&nbsp;</span>
            </div>
        <#if realList.tab?? && realList.tab.itemList?size gt 0>
            <#assign index=1>
            <#list tab_item_list as item>
                <div id="gridDiv${item.id}" class="griddiv" <#if index!=1>style="display:none;"</#if>>
                    <table class="gridtable" <#if index!=1>id="GridTable"</#if>></table>
                </div>
                <#assign index=index+1>
            </#list>
        <#else>
            <div id="gridDiv">
                <table id="GridTable"></table>
            </div>
        </#if>
            <div id="importDiv" style="display:none;">
                <form id="importForm">
                    <input type="hidden" name="fileInfo.realPath" id="realPath">
                    <input type="hidden" name="fileInfo.realName" id="realName">
                    <table cellspacing="0" cellpadding="0" width="300px" align="center">
                        <tr class="listviewTR">
                            <td align="center" id="fileQueueTD" colspan="3">

                            </td>
                        </tr>
                        <tr class="listviewTR">
                            <td align="center" id="uploadifyTD">

                            </td>
                        <#if templateUrl??>
                            <td align="center">
                                <a href="#" class="button"><input type="button"  class="button" onclick="downLoadTemplate()" value="下载模板"></a>
                                <input type="hidden" id="importTemplateUrl" <#if templateUrl??>value="${templateUrl}"</#if>>
                            </td>
                        </#if>
                            <td align="center">
                                <a href="#" class="button"><input type="button"  class="button" onclick="cancelImport()" value="取消"></a>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>
<form id="hiddenForm" method="post">

<#if paramsMap??>
    <#list paramsMap?keys as key>
        	<#if paramsMap[key].field??>
            <input type=hidden name="paramsMap['${key}'].field.id" <#if paramsMap[key].field.id??> value="${paramsMap[key].field.id}"</#if>>
            </#if>
            <input type=hidden name="paramsMap['${key}'].value" <#if paramsMap[key].value??> value="${paramsMap[key].value}"</#if>></input>
            <input type=hidden name="paramsMap['${key}'].entityId" <#if paramsMap[key].entityId??> value="${paramsMap[key].entityId}"</#if>></input>
    </#list>
</#if>
</form>
<script language="javascript">
// JavaScript Document
var searchItemNumber = <#if !filteritem_list?? || filteritem_list?size==0>1<#else>${filteritem_list?size}</#if>;
var fieldArray = [];
<#list list.advancedSearchFieldList as field>
if(!fieldArray['${field.name}']) {
    fieldArray['${field.name}'] = {};
    fieldArray['${field.name}'].name = '${field.name}';
    fieldArray['${field.name}'].type = '${field.type}';
    <#if field.dataRule?? && field.dataRule.dataType?? && field.dataRule.dataType=='number'>
        fieldArray['${field.name}'].isNumber = true;
    </#if>
    fieldArray['${field.name}'].defaultValueType = '${field.defaultValueType?default('')}';
    if(fieldArray['${field.name}'].type=='6' || fieldArray['${field.name}'].type=='15' || fieldArray['${field.name}'].type=='40' || fieldArray['${field.name}'].type=='58' || fieldArray['${field.name}'].type=='7' || fieldArray['${field.name}'].type=='37' || fieldArray['${field.name}'].type=='36') {
        fieldArray['${field.name}.id'] = {};
        fieldArray['${field.name}.id'].name = '${field.name}';
        fieldArray['${field.name}.id'].type = '${field.type}';
        fieldArray['${field.name}.id'].defaultValueType = '${field.defaultValueType?default('')}';
    }

}
</#list>
var tabsVolArray = [<#if realList.tab?? && tab_item_list??><#list tab_item_list as item>"${item.id}"<#if item_has_next>,<#else></#if></#list></#if>];
$(function(){
    layout();
    <#if realList?? && realList.desc??>
    parent.parent.addVisitPath('${realList.name}');
    <#else>
    parent.parent.addVisitPath('${list.name}');
    </#if>
<#if realList.tab?? && realList.tab.itemList?size gt 0>
    <#assign index=1>
    <#assign useSelectTabValue=false>
    <#list tab_item_list as item>
        <#if selectTabValue??>
            <#if item.value == selectTabValue>
			    <#assign useSelectTabValue=true>
	        </#if>
        </#if>
    </#list>
    <#list tab_item_list as item>
        <#if useSelectTabValue>
            <#if item_index == 0>
                $("#${item.id}").removeClass("ui-state-active tab_selected selectedTab");
                $(".contentInner","#${item.id}").css("background-image",'url("./../theme/default/images/main/tabs.png")');
                $(".contentInner","#${item.id}").css('border-top','1px solid #c2e2eb');
                $(".contentInner a span","#${item.id}").css('color','#122664');
                $(".leftBorder","#${item.id}").css('background-image','url(./../theme/default/images/main/tab_left.png)');
                $(".rightBorder","#${item.id}").css('background-image','url(./../theme/default/images/main/tab_right.png)');
            </#if>
            <#if item.value == selectTabValue>
                changeTab('${item.id}');
            </#if>
        <#else>
            <#if index ==1 >
                changeTab('${item.id}');
            </#if>
        </#if>
        <#assign index=index+1>
    </#list>
<#else>
    loadGrid();
</#if>
<#if filteritem_list??>
    $('input,select,textarea',document.getElementById('searchDiv')).each(function(){
        this.disabled = "disabled";
    });
</#if>
    /*reloadTree("1");*/
    $("#all_search").inputStyle({
        operatorId:"all_search_Opt",
        operatorType:"img",
        operatorImg:"./../theme/default/images/main/search.png",
        controllerWidth:200,
        operatorFun:showMenu
    });

    $('#search').click(function(){
        if(!document.getElementById('searchItemFormatter1').disabled) {
            var itemArray = $('table','.searchItem_div_class');
            var linkOperate = '(';
            for(var i=0;i<itemArray.length;i++) {
                var item = itemArray[i];
                if(item && $(item).attr('index')) {
                    if(document.getElementById('searchItemRelation'+$(item).attr('index'))) {
                        linkOperate += $('#searchItemRelation'+$(item).attr('index')).val();
                    }
                    linkOperate += ('field'+$(item).attr('index'));
                }
            }
            linkOperate +=')';
            $('#searchLinkOperate').val(linkOperate);
        }
        $('.serverError').hide();
        $('#GridTable').datagrid("options").url=TDQS.CONTEXT_PATH+'business/list.action?tdqssid='+TDQS.SESSION_ID;
        $('#GridTable').datagrid("tdqsLoad",getFormParams('searchForm'));
    });
    $('#advancedSearch').click(function(){
        $('#searchDiv').hide();
        $('#advancedSearchDiv').show();
        $('#addSearchItem').show();
        $('#addSearchItem_img').show();
        $($('#addSearchItem_img').parents("div").get(0)).show();
        $('input,select,textarea',document.getElementById('searchDiv')).each(function(){
            this.disabled = "disabled";
        });
        $('input,select,textarea','.searchItem_div_class').each(function(){
            this.disabled = "";
        });
        $('#advancedSearch').hide();
        $('#advancedSearch_img').hide();
        $($('#advancedSearch_img').parents("div").get(0)).hide();
        //$($('#search_img').parents("div").get(0)).css("border-left",0);

        $('#commonSearch').show();
        $('#commonSearch_img').show();
        $($('#commonSearch_img').parents("div").get(0)).show();
        if($("#search_condition_switch") && $("#search_condition_switch").hasClass("switchOpen")){
            $(".searchItem_div_class:not('#advancedSearchDiv')").show();
        }else{
            $(".searchItem_div_class:not('#advancedSearchDiv')").hide();
        }
        changeSearchItemName(1);
        var itemArray = $('table','.searchItem_div_class');
        if($(".searchItem_div_class:not('#advancedSearchDiv')").size() > 0){
            $("#search_condition_switch").show();
            $($('#search_img').parents("div").get(0)).css("border-left","1px solid #96d0d2");
        }
        $('#advancedSearchDiv').css("padding-left","65px");
        $("#search_button").css("right","3px");
        $('#search').click();
        $(".buttonsDiv").css("width",320);
    });
    $('#commonSearch').click(function(){
        $('#searchDiv').show();
        $('#advancedSearchDiv').hide();
        $('#addSearchItem').hide();
        $('#addSearchItem_img').hide();
        $($('#addSearchItem_img').parents("div").get(0)).hide();
        $('input,select,textarea',document.getElementById('searchDiv')).each(function(){
            this.disabled = "";
        });
        $('input,select,textarea','.searchItem_div_class').each(function(){
            this.disabled = "disabled";
        });
        $('#advancedSearch').show();
        $('#advancedSearch_img').show();
        $($('#advancedSearch_img').parents("div").get(0)).show();
        $('#commonSearch').hide();
        $('#commonSearch_img').hide();
        $($('#commonSearch_img').parents("div").get(0)).hide();
        $(".searchItem_div_class:not('#advancedSearchDiv')").hide();
        $("#search_condition_switch").hide();
        //$($('#search_img').parents("div").get(0)).css("border-left",0);
        //$('#searchDiv').css("padding-left","15px");
        //$("#search_button").css("right",18);
        $('#search').click();
        $(".buttonsDiv").css("width",200);
    });
    $('#addSearchItem').click(function(){
        var itemArray = $('table','.searchItem_div_class');
        var preItem = itemArray[itemArray.length-1];
        searchItemNumber++;
        var newDiv= $("<div/>");
        $(newDiv).attr("id",'searchItem_div'+searchItemNumber);
        $(newDiv).attr("class",'searchItem_div_class');
        $(newDiv).css({
            "position":"relative",
            "float":"left",
            "background-image":'url("/PNPMS/theme/default/images/main/seach_area_bg.png")',
            "width":"100%",
            "height":"32px",
            "border-left":"1px solid #96d0d2",
            "border-right":"1px solid #96d0d2",
            "border-bottom":"1px solid #96d0d2",
            "padding-left":"15px"
        })
        var newItem = document.createElement('table');
        $(newItem).attr("cellspacing",0);
        $(newItem).attr("cellpadding",0);
        if($.browser.msie&&($.browser.version == "6.0" || $.browser.version == "7.0")){
            $(newItem).css({"line-height":"25px"});
        }else{
            $(newItem).css({"line-height":"26px"});
        }
        $(newItem).appendTo(newDiv);
        newItem.id='searchItem'+searchItemNumber;
        $(newItem).attr('index',searchItemNumber);
        var html='';
        html += "<tr>";
        html += "<td class=\"elementColor\">";
        html += "<select style=\"width:50px;\" class=\"keepsize\" id=\"searchItemRelation"+searchItemNumber+"\">";
        html += "<option value=\"&\">并且</option>";
        html += "<option value=\"|\">或者</option>";
        html += "</select>";
        html += "</td>";

        html += "<td class=\"textColor\" style=\"padding-left:15px\">字段：</td>";

        html += "<td class=\"elementColor\">";
        html += "<select style=\"width:110px;\" onmouseover=\"FixWidth(this)\" onchange=\"changeSearchItemName('"+searchItemNumber+"')\" id=\"searchItemName"+searchItemNumber+"\" name=\"filterMap['field"+searchItemNumber+"'].filterName\">";
    <#list list.advancedSearchFieldList as field>
        <#if field.type=='6' || field.type=='15' || field.type=='40' || field.type=='58' || field.type=='7' || field.type=='37' || field.type=='36'>
            html += "<option value=\"${field.name}.id\">${field.displayName}</option>";
        <#else>
            html += "<option value=\"${field.name}\">${field.displayName}</option>";
        </#if>
    </#list>
        html += "</select>";
        html += "</td>";

        html += "<td class=\"textColor\" style=\"padding-left:15px\">查询方式：</td>";

        html += "<td class=\"elementColor\">";
        html += "<select style=\"width:110px;\" onchange=\"changeSearchItemFormatter('"+searchItemNumber+"')\" id=\"expType"+searchItemNumber+"\" name=\"filterMap['field"+searchItemNumber+"'].expType\">";
        html += "<option id=\"likeExpType"+searchItemNumber+"\" value=\"LIKE\">模糊匹配</option>";
        /*html += "<option id=\"eqExpType"+searchItemNumber+"\" value=\"EQ\">等于</option>";
        html += "<option id=\"neExpType"+searchItemNumber+"\" value=\"NE\">不等于</option>";
        html += "<option id=\"gtExpType"+searchItemNumber+"\" value=\"GT\">大于</option>";
        html += "<option id=\"geExpType"+searchItemNumber+"\" value=\"GE\">大于等于</option>";
        html += "<option id=\"ltExpType"+searchItemNumber+"\" value=\"LT\">小于</option>";
        html += "<option id=\"leExpType"+searchItemNumber+"\" value=\"LE\">小于等于</option>";*/
        html += "</select>";
        html += "<input type=\"hidden\" value=\"likeformatter\" id=\"searchItemFormatter"+searchItemNumber+"\" name=\"filterMap['field"+searchItemNumber+"'].formatter\">";
        html += "</td>";

        html += "<td class=\"textColor\" style=\"padding-left:15px\">查询内容：</td>";

        html += "<td class=\"elementColor\" id=\"searchItemContent"+searchItemNumber+"\">";
        html += "<input style=\"width:104px;\" maxlength=\"1000\" type=\"text\" name=\"filterMap['field"+searchItemNumber+"'].filterValue\"/>";
        html += "</td>";
        html += "<td class=\"elementColor\">";


        html += "<div class=\"searchButtonBox\" style=\"width:20px;padding-left:10px\">";
        html += "<a href=\"javascript:void(0);\" class=\"button switchOpen\" tabindex=\"-1\" onclick=\"removeSearchItem('"+searchItemNumber+"')\" title=\"删除\">";
        html += "<div style=\"border-left:1px solid #96d0d2;border-right:1px solid #96d0d2;position:relative;float:right;cursor:pointer;\">";
        html += "<img id=\"search_switch_a_img\" src=\"./../theme/default/images/main/search/delete.png\" style=\"position:absolute;top:6px\">";
        html += "<input type=\"button\" style=\"margin-top:0px;width:16px;\">";
        html += "</div>";
        html += "</a>";
        html += "</div>";
        html += "</td>";
        html += "</tr>";
        $(newItem).html(html);
        $(newDiv).insertAfter($("#queryForm"));
        //var queryFormHeight = $("#queryForm").height();
        //$("#queryForm").height(queryFormHeight+31);
        $("#search_condition_switch").show();
        $($('#search_switch_a_img').parents("div").get(0)).css("border-left","1px solid #96d0d2");
        changeSearchItemName(searchItemNumber);

    });

    document.getElementsByTagName('form')[0].onkeydown = function(e){
        var e = e || event;
        var keyNum = e.which || e.keyCode;
        if(keyNum==13){
        ${"$('#search')"}.click();
            return false;
        }
        return true;
    };
    $('#GridTable').datagrid("autoresize");
});

function changeTab(itemId) {
    $('#listTabItem').val(itemId);
    $('.griddiv').hide();
    $('.gridtable','.griddiv').each(function(){
        $(this).attr('id','');
    });
    $(document.getElementById('gridDiv'+itemId)).show();
    $('.gridtable',document.getElementById('gridDiv'+itemId)).each(function(){
        $(this).attr('id','GridTable');
    });
    var length = $('.datagrid',document.getElementById('gridDiv'+itemId)).length;
    if(length==0) {
        eval("loadGrid"+itemId+"()");
    } else {
        if(!document.getElementById('searchItemFormatter1').disabled) {
            var itemArray = $('table','.searchItem_div_class');
            var linkOperate = '(';
            for(var i=0;i<itemArray.length;i++) {
                var item = itemArray[i];
                if(item && $(item).attr('index')) {
                    if(document.getElementById('searchItemRelation'+$(item).attr('index'))) {
                        linkOperate += $('#searchItemRelation'+$(item).attr('index')).val();
                    }
                    linkOperate += ('field'+$(item).attr('index'));
                }
            }
            linkOperate +=')';
            $('#searchLinkOperate').val(linkOperate);
        }
        $('#GridTable').datagrid("tdqsReload",getFormParams('searchForm'));
    }
    $(document.getElementById(itemId)).addClass("ui-state-active tab_selected selectedTab");
    $(".contentInner","#"+itemId).css("background-image",'url("./../theme/default/images/main/tabs_down.png")');
    $(".contentInner","#"+itemId).css('border-top','1px solid #2b729a');
    $(".contentInner a span","#"+itemId).css('color','#FFFFFF');
    $(".leftBorder","#"+itemId).css('background-image','url(./../theme/default/images/main/tab_left_down.png)');
    $(".rightBorder","#"+itemId).css('background-image','url(./../theme/default/images/main/tab_right_down.png)');
    resizeDatagrid();
}

function removeSearchItem(number) {
    $('#searchItem'+number).remove();
    $('#searchItem_div'+number).remove();
    var itemArray = $('table','.searchItem_div_class');
    if($(".searchItem_div_class:not('#advancedSearchDiv')").size() == 0){
        $("#search_condition_switch").hide();
        $($('#search_switch_a_img').parents("div").get(0)).css("border-left",0);
    }
}
function changeSearchItemFormatter(number) {
    var expType = document.getElementById('expType'+number).value;
    var type = fieldArray[$('#searchItemName'+number).val()].type;
    if(expType=='LIKE') {
        $('#searchItemFormatter'+number).val('likeformatter');
    } else {
        if(type == '65') {
            $('#searchItemFormatter'+number).val('YearAndMonthFormatter');
        } else if(type == '3' || type == '35') {
            $('#searchItemFormatter'+number).val('simpleDateFormatter');
        } else if(type=='62') {
            $('#searchItemFormatter'+number).val('likeformatter');
        } else {
            $('#searchItemFormatter'+number).val('');
        }
    }
}

function changeSearchItemName(number) {
    var type = fieldArray[$('#searchItemName'+number).val()].type;
    var isNumber = fieldArray[$('#searchItemName'+number).val()].isNumber;
    $('#likeExpType'+number).remove();
    $('#eqExpType'+number).remove();
    $('#neExpType'+number).remove();
    $('#gtExpType'+number).remove();
    $('#geExpType'+number).remove();
    $('#ltExpType'+number).remove();
    $('#leExpType'+number).remove();
    if(type=='3'|| type=='35' || type=='65' || type=='66') {
        // 日期类型，不支持模糊匹配
        var eqOption = document.createElement('option');
        $(eqOption).html('等于');
        $(eqOption).attr('value','EQ');
        eqOption.id='eqExpType'+number;
        $('#expType'+number).append($(eqOption));
        var neOption = document.createElement('option');
        $(neOption).html('不等于');
        $(neOption).attr('value','NE');
        neOption.id='neExpType'+number;
        $('#expType'+number).append($(neOption));
        var gtOption = document.createElement('option');
        $(gtOption).html('大于');
        $(gtOption).attr('value','GT');
        gtOption.id='gtExpType'+number;
        $('#expType'+number).append($(gtOption));
        var geOption = document.createElement('option');
        $(geOption).html('大于等于');
        $(geOption).attr('value','GE');
        geOption.id='geExpType'+number;
        $('#expType'+number).append($(geOption));
        var ltOption = document.createElement('option');
        $(ltOption).html('小于');
        $(ltOption).attr('value','LT');
        ltOption.id='ltExpType'+number;
        $('#expType'+number).append($(ltOption));
        var leOption = document.createElement('option');
        $(leOption).html('小于等于');
        $(leOption).attr('value','LE');
        leOption.id='leExpType'+number;
        $('#expType'+number).append($(leOption));
        $('#searchItemContent'+number).html('');
        var html = '';
        if(type=='3' || type=='35') {
            html = "<input style=\"width:106px;\" type=\"text\" class=\"Wdate\" onfocus=\"WdatePicker();\" name=\"filterMap['field"+number+"'].filterValue\"/>";
        } else if(type=='65') {
            html = "<input style=\"width:106px;\" type=\"text\" class=\"Wdate\" onfocus=\"WdatePicker({dateFmt:'yyyy年M月'});\" name=\"filterMap['field"+number+"'].filterValue\"/>";
        } else if(type=='66') {
            html = "<input style=\"width:106px;\" type=\"text\" class=\"Wdate\" onfocus=\"WdatePicker({dateFmt:'yyyy'});\" name=\"filterMap['field"+number+"'].filterValue\"/>";
        }
        $('#searchItemContent'+number).html(html);
        $('#searchItemFormatter'+number).val('');
        if(type=='65') {
            $('#searchItemFormatter'+number).val('YearAndMonthFormatter');
        } else if(type=='3' || type=='35') {
            $('#searchItemFormatter'+number).val('simpleDateFormatter');
        }
    } else if(type=='4') {
        // 复选框
        var eqOption = document.createElement('option');
        $(eqOption).html('等于');
        $(eqOption).attr('value','EQ');
        eqOption.id='eqExpType'+number;
        $('#expType'+number).append($(eqOption));
        $('#searchItemContent'+number).html('');
        var html = "<select style=\"width:110px;\" onmouseover=\"FixWidth(this)\" name=\"filterMap['field"+number+"'].filterValue\" id=\"valueSelect"+number+"\"><option value=''>全部</option><option value='1'>是</option><option value='0'>否</option></select>";
        $('#searchItemContent'+number).html(html);
        $('#searchItemFormatter'+number).val('');
    } else if(type=='6' || type=='15' || type=='40' || type=='58' || type=='7' || type=='37'|| type=='36') {
        // 单位类型
        var eqOption = document.createElement('option');
        $(eqOption).html('等于');
        $(eqOption).attr('value','EQ');
        eqOption.id='eqExpType'+number;
        $('#expType'+number).append($(eqOption));
        $('#searchItemContent'+number).html('');
        var html = "<input type=\"text\" readonly=\"readonly\" id=\"fieldCompany"+number+"\" name=\"filterMap['companyName"+number+"'].filterValue\" class=\"textTest\" />";
        html += "<input type=\"hidden\" id=\"fieldCompanyId"+number+"\" name=\"filterMap['field"+number+"'].filterValue\" />";
        if(type!='7') {
        	html += "<input type=\"hidden\"  name=\"filterMap['field"+number+"'].isCompanyQuery\" value=\"1\" />";
        }
        html += "<div id=\"fieldDropdownMenu"+number+"\" class=\"dropDD_contentDiv\">";
        html += "<div style=\"overflow:auto;height:266px\">";
        html += "<ul id=\"fieldCompanyTree"+number+"\" class=\"tree\"></ul>";
        html += "</div>";
        html += "<div class=\"buttonBox\" style=\"position:absolute;bottom:0px;background:#f3f4f4;height:30px;padding-top:4px\">";
        html += "<a href=\"javascript:void(0);\" class=\"button\" tabindex=\"-1\"><input type=\"button\" onclick=\"window.curDDWin.saveWin();return false;\" value=\"确认\"></a>";
        html += "<a href=\"javascript:void(0);\" class=\"button\" tabindex=\"-1\"><input type=\"button\" onclick=\"clearCompanySelect('"+number+"');return false;\" value=\"清空\"></a>";
        html += "</div>";
        html += "</div>";
        $('#searchItemContent'+number).html(html);
        var url = TDQS.CONTEXT_PATH+"company/tree.action";
        if(type=='37') {
            url = TDQS.CONTEXT_PATH+"company/notLeafTree.action";
        }
        if(type=='36') {
            url = TDQS.CONTEXT_PATH+"company/forPlanRecord.action";
        }
        var setting = {
            asyncUrl : url,
            asyncParam : ["id"],
            async : true,
            callback : {
                click : function(event, treeId, treeNode) {
                    $(document.getElementById('fieldCompany'+number)).val(treeNode.name);
                    $(document.getElementById('fieldCompanyId'+number)).val(treeNode.id);
                    window.curDDWin.saveWin();

                },
                loadTreeSuccess : function(zTree, msg) {
                    //zTree.expandAll();
                    var nodes = zTree.setting.root['nodes'];
                    for(var i=0;i<nodes.length;i++) {
                        zTree.expandNode(nodes[i],true,false);
                    }
                }
            }
        };
        if(type=='7') {
            url = TDQS.CONTEXT_PATH+"region/alltree.action";
            setting = {
                asyncUrl : url,
                asyncParam : ["id"],
                async : true,
                callback : {
                    click : function(event, treeId, treeNode) {
                        $(document.getElementById('fieldCompany'+number)).val(treeNode.name);
                        $(document.getElementById('fieldCompanyId'+number)).val(treeNode.id);
                        window.curDDWin.saveWin();

                    },
                    loadTreeSuccess : function(zTree, msg) {
                    }
                }
            };
        }
        $("#fieldCompanyTree"+number).zTree(setting);
        $(document.getElementById('fieldCompany'+number)).inputStyle({
            operatorId:"companyMenuBtn"+number,
            operatorType:"text",
            operatorText:"选择",
            controllerWidth:108,
            operatorFun:function(){
            	$("input[type='button']",$('.dropDD_contentDiv')).each(function(){
					this.style.backgroundImage="url(./../theme/default/images/main/btn_normal.png)";
					$(this).hover(function(){this.style.backgroundImage="url(./../theme/default/images/main/btn_over.png)";},function(){this.style.backgroundImage="url(./../theme/default/images/main/btn_normal.png)";});
				});
                new DDWin({
                    el:"fieldDropdownMenu"+number
                    ,dep:'divAround_fieldCompany'+number
                    ,clickBody:'save'
                });
            },
            imgFun:function(){
                $(document.getElementById('fieldCompany'+number)).val("");
                $(document.getElementById('fieldCompanyId'+number)).val("");
                window.curDDWin.saveWin();
            }
        });
        $('#searchItemFormatter'+number).val('');
    } else if(type=='10' || type=='63'  || type=='82' || type=='62') {
        // 值对象
        var eqOption = document.createElement('option');
        if(type=='62') {
            $(eqOption).html('模糊匹配');
            $(eqOption).attr('value','LIKE');
        } else {
            $(eqOption).html('等于');
            $(eqOption).attr('value','EQ');
        }
        eqOption.id='eqExpType'+number;
        $('#expType'+number).append($(eqOption));
        $('#searchItemContent'+number).html('');
        var html = "<select style=\"width:110px;\" onmouseover=\"FixWidth(this)\" name=\"filterMap['field"+number+"'].filterValue\" id=\"valueSelect"+number+"\"><option value=''>全部</option></select>";
        $('#searchItemContent'+number).html(html);
        var defaultValueType = fieldArray[$('#searchItemName'+number).val()].defaultValueType;
        var planitemVolclass = '';
        if(document.getElementById('planitemVolclass')) {
        	planitemVolclass = $('#planitemVolclass').val();
        }
        $.tdqsAjax({
            type: "post",
            dataType: "json",
            url: TDQS.CONTEXT_PATH+'business/getValueObjectList?tdqssid='+TDQS.SESSION_ID+'&defaultValueType='+defaultValueType+'&planitemVolclass='+encodeURI(planitemVolclass),
            success:function(json) {
                if(json && json.data) {
                    for(var i=0;i<json.data.length;i++) {
                        var valueObject = json.data[i];
                        var option = document.createElement('option');
                        $(option).html(valueObject.name);
                        $(option).attr('value',valueObject.value);
                        $('#valueSelect'+number).append($(option));
                    }
                }
            }
        });
        $('#searchItemFormatter'+number).val('');
        if(type=='62') {
            $('#searchItemFormatter'+number).val('likeformatter');
        }
    } else {
        // 普通字段
        var likeOption = document.createElement('option');
        if(!isNumber) {
            $(likeOption).html('模糊匹配');
            $(likeOption).attr('value','LIKE');
            likeOption.id='likeExpType'+number;
            $('#expType'+number).append($(likeOption));
        } else {
	        var eqOption = document.createElement('option');
	        $(eqOption).html('等于');
	        $(eqOption).attr('value','EQ');
	        eqOption.id='eqExpType'+number;
	        $('#expType'+number).append($(eqOption));
	        var neOption = document.createElement('option');
	        $(neOption).html('不等于');
	        $(neOption).attr('value','NE');
	        neOption.id='neExpType'+number;
	        $('#expType'+number).append($(neOption));
	        var gtOption = document.createElement('option');
	        $(gtOption).html('大于');
	        $(gtOption).attr('value','GT');
	        gtOption.id='gtExpType'+number;
	        $('#expType'+number).append($(gtOption));
	        var geOption = document.createElement('option');
	        $(geOption).html('大于等于');
	        $(geOption).attr('value','GE');
	        geOption.id='geExpType'+number;
	        $('#expType'+number).append($(geOption));
	        var ltOption = document.createElement('option');
	        $(ltOption).html('小于');
	        $(ltOption).attr('value','LT');
	        ltOption.id='ltExpType'+number;
	        $('#expType'+number).append($(ltOption));
	        var leOption = document.createElement('option');
	        $(leOption).html('小于等于');
	        $(leOption).attr('value','LE');
	        leOption.id='leExpType'+number;
	        $('#expType'+number).append($(leOption));
        }
        $('#searchItemContent'+number).html('');
        var html = "<input style=\"width:104px;\" type=\"text\" maxlength=\"1000\" name=\"filterMap['field"+number+"'].filterValue\"/>";
        $('#searchItemContent'+number).html(html);
        $('#searchItemFormatter'+number).val('likeformatter');
    }
}

function clearCompanySelect(number) {
    $(document.getElementById('fieldCompany'+number)).val("");
    $(document.getElementById('fieldCompanyId'+number)).val("");
    window.curDDWin.saveWin();
}


function showUrl(url) {
    url = TDQS.CONTEXT_PATH+ encodeURI(url);
    if(url.indexOf('?')==-1) {
        url += '?';
    } else {
        url += '&';
    }
    url += 'date='+new Date().toLocaleString();
    postForm(url);
}

function downLoadTemplate() {
    var url = $('#importTemplateUrl').val();
    if(url!='') {
        showUrl(url);
    }
}

jQuery.fn.isChildAndSelfOf = function(b){//jquery扩展功能

    return (this.closest(b).length > 0);

};

function showFunctionGroup(selfobj,obj,id,e) {
    if($.browser.msie){
        cancelBubble=true;
    }else{
        e.stopPropagation();
    }
    //var toolbarWidth = $(".program_toolbar").width();
    //$(".program_toolbar").width(toolbarWidth+$('#div'+id).width());
    $(selfobj).addClass("overListButton"+id);
    $("a",selfobj).addClass("overListButton"+id);
    $("img",selfobj).addClass("overListButton"+id);
    $("ul",selfobj).addClass("overListButton"+id);
    $("li",selfobj).addClass("overListButton"+id);
    $("div",selfobj).addClass("overListButton"+id);
    $("span",selfobj).addClass("overListButton"+id);
    $('#div'+id).show();

    //IE6计算最大宽度
    var liMaxWidth = 0;
    if($.browser.msie&&($.browser.version == "6.0")){
        $("li>a",'#div'+id + "> ul").each(function(){
            if($(this).width() > liMaxWidth){
                liMaxWidth = $(this).width();
            }
        })
        $('#div'+id).css({"width":liMaxWidth+11 + "px"});
    }else{
        //IE7设置100%
        $('#div'+id).css({"width":"100%"});
    }

    var popDiv = $("<div style='height:200px;position:absolute;background-color:#FFFFFF;border:1px solid #C54F00;border-top:0px;z-index:100;'/>");
    var topLine = $("<div style='border:0px;border-top: 1px solid #C54F00;height:1px;overflow:hidden;float:left;position:relative;clear:left'>");
    var currentLi = $($(obj).parents("li").get(0));
    var currentLiWidth = $(currentLi).width();
    $(topLine).appendTo($(popDiv));
    $('#div'+id).appendTo($(popDiv));
    $(popDiv).appendTo("body");
    $(currentLi).css({"border":"1px solid #C54F00","border-bottom":"0px","background":"#FFFFFF"});

    var cWidth = window.innerWidth || document.documentElement.clientWidth;
    //判断是否按钮在最右侧
    var topSpacing = 0;
    if($.browser.msie && parseInt($.browser.version) <= 7 ){
        topSpacing = 5;
    }

    $(popDiv).attr("id","listButton_popDiv"+id);
    $(popDiv).addClass("listButton_popDiv");
    $(popDiv).height($('#div'+id).height()+3);
    $(popDiv).width($('#div'+id).width()+40);
    var divContentw = $('#div'+id).width();

    if(cWidth - ($(obj).offset().left + $(obj).width()) < (divContentw-currentLiWidth-10)){
        $(popDiv).css({right:cWidth - ($(obj).offset().left + $(obj).width())-6 + "px", top:$(obj).offset().top+$(obj).height()-topSpacing + "px"}).slideDown("fast");
        $(topLine).css({width:$(popDiv).width()-currentLiWidth-10 + "px",left:0 + "px"});
    }else{
        $(popDiv).css({left:$(obj).offset().left-26 + "px", top:$(obj).offset().top+$(obj).height()-topSpacing + "px"}).slideDown("fast");
        $(topLine).css({width:$(popDiv).width()-currentLiWidth-10 + "px",left:currentLiWidth+10});
    }

    $(document.body).bind("mouseover",function(e) {
        //console.log(e.target.tagName);
        var eventTarget;
        if($.browser.msie){
            eventTarget = e.srcElement;
        }else{
            eventTarget = e.target;
        }
        if(eventTarget.id == 'listButton_popDiv'+id || $(eventTarget).parents("#listButton_popDiv"+id).length>0 || $(eventTarget).hasClass("overListButton"+id)){

        }else{
            $('#div'+id).appendTo("body");
            $('#div'+id).hide();
            $(currentLi).css({"border":"0px","border-right":"1px solid #edfbfe","border-left":"1px solid #edfbfe","border-top":"1px solid #edfbfe","background":""});
            $(eventTarget).removeClass("overListButton"+id);
            $(selfobj).removeClass("overListButton"+id);
            $("a",selfobj).removeClass("overListButton"+id);
            $("img",selfobj).removeClass("overListButton"+id);
            $("ul",selfobj).removeClass("overListButton"+id);
            $("li",selfobj).removeClass("overListButton"+id);
            $("div",selfobj).removeClass("overListButton"+id);
            $("span",selfobj).removeClass("overListButton"+id);
            $("#listButton_popDiv"+id).remove();
            $(popDiv).remove();
            $(document.body).unbind("mouseover");
        }
    })
}

function processOver(obj){
    $(obj).css("background-color","#f3f4f4");
}

function processOut(obj){
    $(obj).css("background-color","");
}

function closeFunctionGroup(id,e) {
    //var toolbarWidth = $(".program_toolbar").width();
    //$(".program_toolbar").width(toolbarWidth - $('#div'+id).width());
    //$('#div'+id).hide();
}

function linkByParams(obj) {
	var url = TDQS.CONTEXT_PATH+'business/process?tdqssid='+TDQS.SESSION_ID+"&function.id=${function.id}&list.id=${list.id}&clearSession=true";
	if(obj) {
		var params = $(obj).attr('link');
		eval("var paramArray="+params);
		for(var i=0;i<paramArray.length;i++) {
			var param = paramArray[i];
			url  = url + "&paramsMap['"+param.name+"'].value=" + param.value;
		}
	}
	postForm(url);
}

function linkToFuncAndList(funcId,listid,obj) {

	var url = TDQS.CONTEXT_PATH+'business/process?tdqssid='+TDQS.SESSION_ID+"&function.id="+funcId+"&list.id="+listid+"&clearSession=true";
	if(obj) {
		var params = $(obj).attr('link');
		eval("var paramArray="+params);
		for(var i=0;i<paramArray.length;i++) {
			var param = paramArray[i];
			url  = url + "&paramsMap['"+param.name+"'].value=" + param.value;
		}
	}
	postForm(url);
}


function linkToFunc(funcId,obj) {
	var url = TDQS.CONTEXT_PATH+'business/process?tdqssid='+TDQS.SESSION_ID+"&function.id="+funcId+"&list.id=${list.id}&clearSession=true";
	if(obj) {
		var params = $(obj).attr('link');
		eval("var paramArray="+params);
		for(var i=0;i<paramArray.length;i++) {
			var param = paramArray[i];
			url  = url + "&paramsMap['"+param.name+"'].value=" + param.value;
		}
	}
	postForm(url);
}

function process(funcId,messageType,message,forwardType,clearSession,isPassParams) {
${"$('#functionId')"}.val(funcId);
    var url = TDQS.CONTEXT_PATH+'business/process?tdqssid='+TDQS.SESSION_ID+ "&function.id="+${"$('#functionId')"}.val()+"&businessProcess.id="+${"$('#businessProcessId')"}.val()+"&list.id="+$('#listId').val();
<#if list.isPassParams?? && list.isPassParams=="1">
    //if(isPassParams && isPassParams=='1') {
    url = url+'&'+$('#hiddenForm').serialize();
    //}
</#if>
    if($('#id').val()!='') {
        url += ("&id="+$('#id').val());
    }
<#if list.businessObj?? && list.businessObj.isChild?? && list.businessObj.isChild=="1">
    if($('#parentInstanceId').val() && $('#parentInstanceId').val()!='') {
        url += ("&parentInstance.id="+$('#parentInstanceId').val());
    }
</#if>
    if($('#status').val()!='') {
        url += ("&taskStatus="+$('#status').val());
    }
    if('1'==clearSession) {
        url += "&clearSession=true";
    }
    url += "&date="+new Date().toLocaleString();
    $('#id').val('');
    if(!message||message=='') {
        message = '确定要执行操作吗？';
    }
    if(messageType && messageType=='1') {
        jConfirm(message, '确认对话框 ', function(r) {
            if(r){
                if(forwardType && forwardType=='2') {
                    executeAjaxFunction(url);
                } else if(forwardType && forwardType=='3') {
                    var tempValue1 = $("#searchForm input[name^='filterMap']").serialize();
                    var tempValue2 = $("#searchForm select [name^='filterMap']").serialize();
                    url = url+'&'+tempValue1 + '&'+tempValue2;
                    
                    var linkOperate = $("#linkOperate").val();
		            if(linkOperate){
		            	url=url+'&'+"linkOperate="+linkOperate;
		            }
            
                    url=decodeURI(url);
                    if(url !="" && url.indexOf('%2C')>-1) {
                        var re = /%2C/g;
                        url = url.replace(re,',');
                    }
                    postForm(url);
                } else if(forwardType && forwardType=='4') {
                    exportData();
                } else if(forwardType && forwardType=='5') {
                    importData();
                }
                else {
                    url=decodeURI(url);
                    postForm(url);
                }
            }else{
                $('#id').val('');
                return false;
            }
        });
    }
    else {
        if(forwardType && forwardType=='2') {
            executeAjaxFunction(url);
        } else if(forwardType && forwardType=='3') {
            var tempValue1 = $("#searchForm input[name^='filterMap']").serialize();
            var tempValue2 = $("#searchForm select [name^='filterMap']").serialize();
            url = url+'&'+tempValue1 + '&'+tempValue2;

            var linkOperate = $("#linkOperate").val();
            if(linkOperate){
            	url=url+'&'+"linkOperate="+linkOperate;
            }

            url=decodeURI(url);
            if(url !="" && url.indexOf('%2C')>-1) {
                var re = /%2C/g;
                url = url.replace(re,',');
            }
            postForm(url);
        } else if(forwardType && forwardType=='4') {
            exportData();
        }else if(forwardType && forwardType=='5') {
            importData();
        } else {
            url=decodeURI(url);
            postForm(url);
        }
    }
}

function switchCondition(obj){
    if($(obj).hasClass("switchClose")){
        if($(".searchItem_div_class")){
            $(".searchItem_div_class:not('#advancedSearchDiv')").show();
            $(obj).attr("class","button switchOpen");
            $("#search_switch_a_img",obj).attr("src","/PNPMS/theme/default/images/main/search/search_switch_open_normal.png");
            $(obj).attr("title","收起");
        }
    }else{
        if($(".searchItem_div_class")){
            $(".searchItem_div_class:not('#advancedSearchDiv')").hide();
            $(obj).attr("class","button switchClose");
            $("#search_switch_a_img",obj).attr("src","/PNPMS/theme/default/images/main/search/search_switch_close_normal.png");
            $(obj).attr("title","展开");
        }

    }
}

function getUrl(url){
    //alert('get');
    postForm(url);
}

function exportData() {

    blockProcess($('.bodyClass'),"导出进度：");
    setInterval(function(){
        $.tdqsAjax({
            type : "post",
            url : TDQS.CONTEXT_PATH+'user/percent',// 目标地址
            success : function(json) {
                setblockProcess(json.data);
                if(json.data=='100'){
                    unblockProcess();
                    clearInterval();
                }
            }
        });

    },500);

    //block($('.bodyClass'),"正在导出数据，请稍候......");
    // jConfirm('导出操作需要等待一段时间，您确认要执行导出操作吗？', '确认对话框 ', function(r) {
    //  if(r) {
    var select = $('#GridTable').datagrid('getSelections');
    var primaryValue = "";
    if (select && select != "") {
        for ( var i = 0; i < select.length; i++) {
            if (i < select.length - 1) {
                primaryValue += select[i].id+ ",";

            } else {
                primaryValue += select[i].id;
            }
        }
    }
    $('#id').val(primaryValue);
    $('#exportFrame').remove();
    var frame = document.createElement('iframe');
    frame.id='exportFrame';
    frame.name='exportFrame';
    frame.style.display='none';
    document.body.appendChild(frame);
    var doc = document.getElementById('exportFrame').contentWindow.document;
    doc.write('<html><body></body></html>');
    var form = doc.createElement("form");
    form.action=TDQS.CONTEXT_PATH+'business/process?tdqssid='+TDQS.SESSION_ID;
    var sortName = $('#GridTable').datagrid("options").sortName;
    var sortOrder = $('#GridTable').datagrid("options").sortOrder;
    if(sortName && sortName!='') {
        form.action = form.action + '&sort='+sortName;
        if(sortOrder && sortOrder!='') {
            form.action = form.action + '&order='+sortOrder;
        }
    }
    $(form).attr('method','post');
    var div = doc.createElement("div");
    div.id = "exportSearchDiv";
    div.style.display = "none";
    div.innerHTML=$('#searchForm').html();
    $(form).append(div);
    doc.body.appendChild(form);
    form.submit();

    // }
    //  });

}
function importData() {

    var div = document.createElement('div');
    div.id='fileQueue';
    $(div).css('text-align','left');
    $('#fileQueueTD').append($(div));
    var input = document.createElement('input');
    input.type='file';
    input.name='importUploadify';
    input.id='importUploadify';
    $('#uploadifyTD').append(input);
    $('#importUploadify').uploadify({
        'basepath'       : TDQS.CONTEXT_PATH,
        'queueID'        : "fileQueue",
        'fileDesc' :  '请选择文件',
        'multi' : false,
        'sizeLimit' :1024*1024*50,
        'fileExt' :'*.xls;*.xlsx;',
        'onComplete':function(event, ID, fileObj, response, data){
            var result = $.parseJSON(response);
            $('#realPath').val(result.realPath);
            $('#realName').val(result.realName);
            executeImport();
            //$('#importUploadify').uploadifyClearQueue();
            document.getElementById("fileQueue").innerHTML ="";
            $('#fileQueue').remove();
            $('#importUploadify').remove();
	      },
	      'onCancel':function(){
	      	cancelImport();
	      },
	      'onError':function(){
	      	cancelImport();
	      }
    });
    $.blockUI({message:$('#importDiv')});

}
function cancelImport() {
    $.unblockUI();
    $('#fileQueue').remove();
    $('#importUploadify').remove();
}
function downLoadImportFile(fileName) {
    var url = TDQS.CONTEXT_PATH+"/download/downLoadImportFile?filename="+fileName+"&date="+new Date().toLocaleString();
    var frame = document.createElement("iframe");
    frame.src = url;
    frame.style.display = "none";
    document.body.appendChild(frame);
}

function executeImport() {
    $.unblockUI();
    var url = TDQS.CONTEXT_PATH+"business/process?tdqssid="+TDQS.SESSION_ID+ "&function.id="+$('#functionId').val()+"&businessProcess.id="+$('#businessProcessId').val()+"&list.id="+

            $('#listId').val()+'&'+$('#hiddenForm').serialize();
    blockProcess($('.bodyClass'),"导入进度：");
    setInterval(function(){
        $.tdqsAjax({
            type : "post",
            url : TDQS.CONTEXT_PATH+'user/percent',// 目标地址
            success : function(json) {
                setblockProcess(json.data);
                if(json.data=='100'){
                    unblockProcess();
                    clearInterval();
                }
            }
        });

    },500);
    $.tdqsAjax({
        type: "post",
        dataType: "json",
        data: $('#importForm').serialize(),
        url: url,
        success:function(json) {
            setblockProcess(100);
            unblockProcess();
            clearInterval();
            if(json.data && json.data.type && json.data.type=='2' && json.data.resultData){
                var message = json.data.resultData;
                if(message.indexOf(".xls")>-1 || message.indexOf(".xlsx")>-1) {
                    message = "导入文件存在错误的数据，请下载文件后重新修改并导入！<a href=\"javascript:void(0);\" onclick=\"downLoadImportFile('"+encodeURI

                    (message)+"');return false;\">下载</a>";
                }
                jAlert(message,'提示',function(){
                    $('#GridTable').datagrid("tdqsReload");
                });
            }
            else {
                $('#GridTable').datagrid("tdqsReload");
            }
        ${"$('#id')"}.val('');
            $('#GridTable').datagrid('clearSelections');
            $('input','.datagrid-header-check').each(function(){
                $(this).removeAttr("checked");
            });
        }
    });
}


function executeAjaxFunction(url) {
	var wrap = $(window.parent.document.body);
	if($.browser.msie&&($.browser.version == "6.0")){
		wrap = $('#GridTable').datagrid("getPanel");
	} else if($.browser.msie && ($.browser.version > 6)){
		wrap = $(window.top.document.body);
	}
	blockMsg(wrap,"操作执行中，请稍候...");
    $.tdqsAjax({
        type: "post",
        dataType: "json",
        url: url,
        success:function(json) {
        	unblockMsg();
            if(json.data && json.data.type && json.data.resultData){
                jAlert(json.data.resultData,'提示',function(){
                    $('#GridTable').datagrid("tdqsReload");
                });
            }
            else {
                $('#GridTable').datagrid("tdqsReload");
            }
        ${"$('#id')"}.val('');
            $('#GridTable').datagrid('clearSelections');
            $('input','.datagrid-header-check').each(function(){
                $(this).removeAttr("checked");
            });
        },
        error:function(){
        	unblockMsg();
        }
    });
}
function blockMsg(wrap,msg) {
	if (wrap && msg) {
		$("<div id=\"listBlockDiv\"></div>")
			.css( {
				display : "block",
				width : wrap.width(),
				height : wrap.height(),
				position:"absolute",
				left:"0px",
				top:"0px",
				zIndex:"1000",
				background: "#ccc",
				opacity:"0.3",
				filter:"alpha(opacity=30)"
			}).appendTo(wrap);
			$("<div id=\"listBlockMessageDiv\" class=\"datagrid-mask-msg\"></div>")
				.html(msg)
				.appendTo(wrap)
				.css({
					display : "block",
					left : getBlockDivLeft(wrap),
					top : getBlockDivTop(wrap),
					position:"absolute",
					zIndex:"10000",
					cursor1:"wait",
					background:"#fff url('"+TDQS.CONTEXT_PATH+"theme/default/css/easyui/default/images/pagination_loading.gif') no-repeat scroll 5px 10px",
					border:"2px solid #6593CF",
					color:"#222",
					width:"auto",
					height:"16px",
					padding:"12px 5px 10px 30px"
				});
	}
}
function getBlockDivLeft(wrap) {
	var left =  window.document.body.clientWidth/2;
	if($.browser.msie && ($.browser.version == "6.0")){
		left = (wrap.width() - $('#listBlockMessageDiv').outerWidth()) / 2;
	} else if($.browser.msie && ($.browser.version > 6)){
		left = window.top.document.body.clientWidth/2;
	} else {
		left =  window.document.body.clientWidth/2;
	}
	return left;
}
function getBlockDivTop(wrap) {
	var top =  window.document.body.clientHeight/2;
	if($.browser.msie && ($.browser.version == "6.0")){
		top = (wrap.height() - $("div.datagrid-mask-msg",wrap).outerHeight()) / 2;
	} else if($.browser.msie && ($.browser.version > 6)){
		top = window.top.document.body.clientHeight/2;
	} else {
	    top =  window.document.body.clientHeight/2;
	}
	return top;
}
function unblockMsg() {
	if($.browser.msie&&($.browser.version == "6.0")){
		$('#listBlockMessageDiv').remove();
		$('#listBlockDiv').remove();
	} else if($.browser.msie && ($.browser.version > 6)){
		$(window.top.document.getElementById('listBlockMessageDiv')).remove();
		$(window.top.document.getElementById('listBlockDiv')).remove();
	} else {
		$(window.parent.document.getElementById('listBlockMessageDiv')).remove();
		$(window.parent.document.getElementById('listBlockDiv')).remove();
	}
}
function processLink(id,funcId,processId,clearSession,fieldId,fieldName,value,entityId) {
    $('#id').val(id);
    var url = TDQS.CONTEXT_PATH+'business/process?tdqssid='+TDQS.SESSION_ID+ "&function.id="+funcId+"&businessProcess.id="+processId+"&list.id="+$('#listId').val();
    if($('#id').val()!='') {
        url  += ("&paramsMap['id'].value="+$('#id').val());
    }
    if(fieldName && fieldName!='') {
        url  += ("&paramsMap['"+fieldName+"'].field.id="+fieldId);
        url  += ("&paramsMap['"+fieldName+"'].value="+value);
        url  += ("&paramsMap['"+fieldName+"'].entityId="+entityId);
    }
    if('1'==clearSession) {
        url += "&clearSession=true";
    }
    url += "&date="+new Date().toLocaleString();
    postForm(url);
}

function processRowFunc(id,funcId,status,messageType,message,forwardType,clearSession,isPassParams) {
    $('#id').val(id);
    if(status && status!=''){
        $('#status').val(status);
    }
    if(typeof(parent.addTabPage) != 'undefined') {
    	${"$('#functionId')"}.val(funcId);
    	var url = TDQS.CONTEXT_PATH+'business/process?tdqssid='+TDQS.SESSION_ID+ "&function.id="+${"$('#functionId')"}.val()+"&businessProcess.id="+${"$('#businessProcessId')"}.val()+"&list.id="+$('#listId').val();
	    if($('#id').val()!='') {
	        url += ("&id="+$('#id').val());
	    }
		<#if list.businessObj?? && list.businessObj.isChild?? && list.businessObj.isChild=="1">
		    if($('#parentInstanceId').val() && $('#parentInstanceId').val()!='') {
		        url += ("&parentInstance.id="+$('#parentInstanceId').val());
		    }
		</#if>
	    if($('#status').val()!='') {
	        url += ("&taskStatus="+$('#status').val());
	    }
	    if('1'==clearSession) {
	        url += "&clearSession=true";
	    }
	    url += "&isInnerEdit=1";
	    url += "&date="+new Date().toLocaleString();
	    $('#id').val('');
	    parent.addTabPage(url,"详细信息");
    } else {
    	process(funcId,messageType,message,forwardType,clearSession,isPassParams);
    }
}

function downLoadFunction(id,url) {
    if(url.indexOf('?')==-1) {
        url = url + '?';
    }
    var url = TDQS.CONTEXT_PATH+url+"&instanceId="+id+"&date="+new Date().toLocaleString();
    var frame = document.createElement("iframe");
    frame.src = url;
    frame.style.display = "none";
    document.body.appendChild(frame);
}

function processCommonFunc(funcId,isBatch,messageType,message,forwardType,clearSession,isPassParams) {
    if(isBatch && isBatch=='1') {
        var select = $('#GridTable').datagrid('getSelections');
        var primaryValue = "";
        var status = "";
        if (select && select != "") {
            for ( var i = 0; i < select.length; i++) {
                if (i < select.length - 1) {
                    primaryValue += select[i].id+ ",";
                    if(select[i].status && select[i].status.id) {
                        status += select[i].status.id+ ",";
                    }

                } else {
                    primaryValue += select[i].id;
                    if(select[i].status && select[i].status.id) {
                        status += select[i].status.id;
                    }
                }
            }
        }
        if(!primaryValue || primaryValue=='') {
            jAlert('请选择${businessProcess.businessObj.desc}！','提示',function(){});
            return false;
        }
        $('#id').val(primaryValue);
        $('#status').val(status);
    }
    process(funcId,messageType,message,forwardType,clearSession,isPassParams);
}

function switchList(realListId) {
    var url = TDQS.CONTEXT_PATH+"business/process?tdqssid="+TDQS.SESSION_ID+"&function.id=${function.id}"+"&list.id=${list.id}"+"&realList.id="+realListId;
    if(document.getElementById('parentInstanceId')) {
        url += "&parentInstance.id="+$('#parentInstanceId').val();
    }
    url += $('#hiddenForm').serialize();
    postForm(url);
}

//z_tree data start
var zTree1;

var setting = {
    showLine: true
};

var curType = '0';
var curLi;
function reloadTree(type) {
    if (curLi) curLi.removeClass("focus");
    var setting1 = clone(setting);
    setting1.treeNodeKey = "id";
    setting1.treeNodeParentKey = "pId";
    clone(zNodes);
    setting1.isSimpleData = false;
    zNodes1 = clone(zNodes);

    if (!type) type = (curType=='0') ? '1' : curType;
    setting1.nameCol = "name";
    setting1.expandSpeed = "";
    setting1.fontCss = $("#font_1").attr("checked") ? setFont : {};

    if (type=="1") {
        setting1.showLine = true;
        curLi = $("#defaultStyle");

    }

    curLi.addClass("focus");
    curType = type;
    zTree1 = $("#treeDemo").zTree(setting1, zNodes1);
    $("#nameCode").html(setting1.nameCol);
    $("#expandSpeedCode").html(setting1.expandSpeed);
    $("#fontCssCode").html($("#font_1").attr("checked") ? "setFont" : "{}");
    $("#isSimpleDataCode").html(setting1.isSimpleData + "");

}
function showMenu(){

}
<#if realList.tab?? && realList.tab.itemList?size gt 0>
${"${"}gridContent${"?"}default('')${"}"}
</#if>

function getTitleFormatter(fieldName) {
	var funcStr = "var func=function(value, row, index){"
	funcStr += " var fieldValue = ''; ";
	funcStr += " if(row.fieldMap['"+fieldName+"'] && row.fieldMap['"+fieldName+"'].value) { ";
	funcStr += " fieldValue = row.fieldMap['"+fieldName+"'].value; ";
	funcStr += " } ";
	funcStr += " var displayValue = ''; ";
	funcStr += " if(row.fieldMap['"+fieldName+"'] && row.fieldMap['"+fieldName+"'].displayValue) { ";
	funcStr += " displayValue = row.fieldMap['"+fieldName+"'].displayValue; ";
	funcStr += " } ";
	funcStr += " if(displayValue && displayValue!=null && displayValue!='') { ";
	funcStr += " fieldValue = displayValue; ";
	funcStr += " } ";
	funcStr += " if(fieldValue=='') { ";
	funcStr += " fieldValue = '&nbsp;'; ";
	funcStr += " } ";
	funcStr += " if(row.editStatusFunction && row.editStatusFunction.id) { ";
	funcStr += " var value = getTitleLink(row.id,row.editStatusFunction.id,row.editStatusFunction.clearSession,fieldValue); ";
	funcStr += " return value; ";
	funcStr += " } ";
	funcStr += " return fieldValue; ";
	funcStr += "}";
	eval(funcStr);
	return func;
}

function getColumnFormatter(fieldName,isLink,linkFuncId,businessProcessId,clearSession,fieldId) {
	var funcStr = "var func=function(value, row, index){"
	funcStr += " var fieldValue = ''; ";
	funcStr += " if(row.fieldMap['"+fieldName+"'] && row.fieldMap['"+fieldName+"'].value) { ";
	funcStr += " fieldValue = row.fieldMap['"+fieldName+"'].value; ";
	funcStr += " } ";
	funcStr += " var displayValue = ''; ";
	funcStr += " if(row.fieldMap['"+fieldName+"'] && row.fieldMap['"+fieldName+"'].displayValue) { ";
	funcStr += " displayValue = row.fieldMap['"+fieldName+"'].displayValue; ";
	funcStr += " } ";
	funcStr += " if(displayValue && displayValue!=null && displayValue!='') { ";
	funcStr += " fieldValue = displayValue; ";
	funcStr += " } ";
   
	if(isLink) {
		funcStr += " var value = getColumnLink(row.id,linkFuncId,businessProcessId,clearSession,fieldId,fieldName,row.fieldMap['"+fieldName+"'].value,row.fieldMap['"+fieldName+"'].entityId,fieldValue); ";
		funcStr += " return value; ";
	} else {
		funcStr += " if(fieldValue=='') { ";
		funcStr += " fieldValue = '&nbsp;'; ";
		funcStr += " } ";
	}
	funcStr += " return fieldValue; ";
	funcStr += "}";
	eval(funcStr);
	return func;
}

function getOperFormatter(value, row, index) {
	var opers = '';
  if(row && row.listFunctionList) {
  	var status = '';
  	if(row.status && row.status.id) {
  		status = row.status.id;
  	}
      for(var i=0,l=row.listFunctionList.length;i<l;i++) {
           var func = row.listFunctionList[i];
           var funcId = '';
           var messageType = '';
           var message = '';
           var funcName = '';
           var forwardType = '';
           var clearSession = '';
           var isPassParams = '';
           if(func) {
               if(func.id) {
                   funcId = func.id;
               }
               if(func.messageType) {
                   messageType = func.messageType;
               }
               if(func.message) {
                   message = func.message;
               }
               if(func.displayName) {
                   funcName = func.displayName;
               }
               else if(func.desc) {
                   funcName = func.desc;
               }
               if(func.forwardType) {
                   forwardType = func.forwardType;
               }
               if(func.clearSession) {
                   clearSession = func.clearSession;
               }
               if(func.isPassParams) {
                   isPassParams = func.isPassParams;
               }
           }
           if(func.type=='6' && func.url) {
           	opers += "<a href=\"javascript:void(0)\" onclick=\"javascript:downLoadFunction('"+row.id+"','"+func.url+"');return false;\">"+funcName+"</a>";
           	opers += "&nbsp;&nbsp;";
           } else if(!row.editStatusFunction || row.editStatusFunction.id !== func.id) {
           	opers += "<a href=\"javascript:void(0)\" onclick=\"javascript:processRowFunc('"+row.id+"','"+funcId+"','"+status+"','"+messageType+"','"+message+"','"+forwardType+"','"+clearSession+"','"+isPassParams+"');return false;\">"+funcName+"</a>";
           	opers += "&nbsp;&nbsp;";
           }
      }
  }
  if(opers=='') {
       opers = '&nbsp;';
  }
  return opers; 
}

function getTitleLink(rowId,editFuncId,clearSession,fieldValue) {
	return "<a href=\"javascript:void(0);\" onclick=\"processRowFunc('"+rowId+"','"+editFuncId+"','"+""+"','"+""+"','"+""+"','"+""+"','"+clearSession+"');return false;\"><div style=\"word-break: break-all;\">"+fieldValue+"</div></a>";
}

function getColumnLink(rowId,linkFuncId,businessProcessId,clearSession,fieldId,fieldName,value,entityId,fieldValue) {
	return "<a href=\"javascript:void(0);\" onclick=\"processLink('"+rowId+"','"+linkFuncId+"','"+businessProcessId+"','"+clearSession+"','"+fieldId+"','"+fieldName+"','"+value+"','"+entityId+"');return false;\">"+fieldValue+"</a>";
}

function loadGrid(){
     ${"$('#GridTable')"}.datagrid({            
            url:TDQS.CONTEXT_PATH+'business/list.action?ajaxLoadType=1&tdqssid='+TDQS.SESSION_ID,
            queryParams:$.extend(getFormParams('hiddenForm'),getFormParams('searchForm')),
            idField:"id",
            pageNumber:${pager.currentPage?default(1)},
            pageSize:${pager.pageSize?default(1)},
            sortName: "<#if sort??>${sort}</#if>",
            <#if realList.isPaging?? && realList.isPaging=='0'>pagination:false,</#if>
sortOrder: "<#if order??>${order}</#if>",
frozenColumns:[[
<#if !(list.isShowCheck?? && list.isShowCheck=="0")>
{field : 'ck',checkbox : true,defaultValue : ''},
</#if>
{field : 'indexer',title : '序号',width : 50,formatter:${"$"}.fn.datagrid.defaults.indexFormatter,edit : false,align : 'center',defaultValue : ''}
<#list listFields as listField>
<#if listField.frozen?? && listField.frozen=='1' && (!listField.isHidden?? || listField.isHidden=='0')>
,{field : '${listField.field.name}',title : '${listField.title}',width : ${listField.width},editor : 'text',defaultValue : <#if listField.defaultValue??>'${listField.defaultValue}'<#else>''</#if>,align : <#if listField.align??>'${listField.align}'<#else>'center'</#if>,edit : true,sortable : <#if listField?? && listField.sortable?? && listField.sortable=="1">true<#else>false</#if>,formatter:getTitleFormatter('${listField.field.name}')}
</#if>
</#list>
] ],
columns:[[
<#if realList.isHierarchyTitle?? && realList.isHierarchyTitle=='1'>
<#assign index=0>
<#list listFieldList as fieldList>
<#if index gt 0 && index lt listFieldList?size>
],[
</#if>
<#assign fieldIndex=0>
<#list fieldList as listField>
<#if (!listField.frozen?? || listField.frozen=='0') && (!listField.isHidden?? || listField.isHidden=='0')>
<#if fieldIndex gt 0>
    ,
</#if>
<#if listField.isTitle?? && listField.isTitle == "1">
    {field:'',title:'${listField.title}',width:${listField.width},rowspan:<#if listField.rowSpan??>${listField.rowSpan}<#else>1</#if>,colspan:<#if listField.colSpan??>${listField.colSpan}<#else>1</#if>}
<#else>
    {field : '${listField.field.name}',title : '${listField.title}',width : ${listField.width},editor : 'text',rowspan:<#if listField.rowSpan??>${listField.rowSpan}<#else>1</#if>,colspan:<#if listField.colSpan??>${listField.colSpan}<#else>1</#if>,defaultValue : <#if listField.defaultValue??>'${listField.defaultValue}'<#else>''</#if>,align : <#if listField.align??>'${listField.align}'<#else>'center'</#if>,edit : true,sortable : <#if listField?? && listField.sortable?? && listField.sortable=="1">true<#else>false</#if>,formatter:getColumnFormatter('${listField.field.name}',<#if listField?? && listField.linkFunction?? && listField.linkable>true,'<#if listField.linkFunction.id??>${listField.linkFunction.id}</#if>','<#if listField.linkFunction.businessProcess?? && listField.linkFunction.businessProcess.id??>${listField.linkFunction.businessProcess.id}</#if>','<#if listField.linkFunction.clearSession??>${listField.linkFunction.clearSession}</#if>','<#if listField.field.id??>${listField.field.id}</#if>'<#else>false</#if>)}
</#if>
<#assign fieldIndex=fieldIndex+1>
</#if>
</#list>
<#if index == 0>
<#if list.allowOperColumn?? && list.allowOperColumn=="1">
,
{field : 'opt',title : '操作',width : <#if list.operColumnWidth??>${list.operColumnWidth}<#else>200</#if>,align : 'center',rowspan : 2,formatter:getOperFormatter}
</#if>
</#if>
<#assign index=index+1>
</#list>
<#else>
<#assign index=0>
<#list listFields as listField>
<#if listField.field?? && (!listField.frozen?? || listField.frozen=='0') && (!listField.isHidden?? || listField.isHidden=='0')>
<#if index gt 0>
,
</#if>
{field : '${listField.field.name}',title : '${listField.title}',width : ${listField.width},editor : 'text',defaultValue : <#if listField.defaultValue??>'${listField.defaultValue}'<#else>''</#if>,align : <#if listField.align??>'${listField.align}'<#else>'center'</#if>,edit : true,sortable : <#if listField?? && listField.sortable?? && listField.sortable=="1">true<#else>false</#if>,formatter:getColumnFormatter('${listField.field.name}',<#if listField?? && listField.linkFunction?? && listField.linkable>true,'<#if listField.linkFunction.id??>${listField.linkFunction.id}</#if>','<#if listField.linkFunction.businessProcess?? && listField.linkFunction.businessProcess.id??>${listField.linkFunction.businessProcess.id}</#if>','<#if listField.linkFunction.clearSession??>${listField.linkFunction.clearSession}</#if>','<#if listField.field.id??>${listField.field.id}</#if>'<#else>false</#if>)}
<#assign index=index+1>
</#if>
</#list>
<#if list.allowOperColumn?? && list.allowOperColumn=="1">
,
{field : 'opt',title : '操作',width : <#if list.operColumnWidth??>${list.operColumnWidth}<#else>200</#if>,align : 'center',rowspan : 2,formatter:getOperFormatter}
</#if>
</#if>
] ],
operations:{},
loadSuccess:function(){
    $('#GridTable').datagrid("options").url=TDQS.CONTEXT_PATH+'business/list.action?tdqssid='+TDQS.SESSION_ID;
}
});

}

function resizeDatagrid(){
    $('#GridTable').datagrid("autoresize");
    if(processRemarker){
        $(".center_all_div").css({"top":"60px"});
    }else if(${hiddenItem} == 1){
        $(".center_all_div").css({"top":0});
    }else{
        $(".center_all_div").css({"top":"34px"});
    }
}

function layout(){
    var toggle_we        = '<div class="btnToggler_we"></div>'
            , toggle_w            = '<div class="btnToggler_w"></div>'
            , btnToggler_se        = '<div class="btnToggler_se"></div>'
            , btnToggler_s        = '<div class="btnToggler_s"></div>'

    $('body').layout({
        center:{
            paneSelector:    ".center_all_div"
        }

    });
    $(".center_all_div").css({"position":"relative"});
    if(processRemarker){
        $(".center_all_div").css({"top":"60px"});
    }else if(${hiddenItem} == 1){
        $(".center_all_div").css({"top":0});
    }else{
        $(".center_all_div").css({"top":"34px"});
    }
    $('div.center_all_div').layout({
        defaults:{
            onresize_end:    resizeDatagrid
            ,onclose_end:    resizeDatagrid
        }
        ,center:{
            paneSelector:    ".center_c"
        }
        ,north:{
            size:    3
            ,    paneSelector:    ".center_n"
            ,    spacing_open:    0
            ,    spacing_closed:    0
        }
    });
    $(".center_n").css({overflow:"hidden"});

    $('div.center_c').layout({
        center:{
            paneSelector:    ".center_c_c"
        }
        ,north:{
            paneSelector:    ".center_c_n"
            ,    size:    30
            ,    spacing_open:    0
            ,    spacing_closed:    0
        }
    });
    $(".center_c_n").css({overflow:"hidden"});

    /*
    $('div.west_c').layout({
        <#if  renderStatus>
            south:{
                paneSelector:    ".west_c_s" 
            },
            </#if>
            center:{
                    paneSelector:    ".west_c_c"
                ,   size:    300
                ,    spacing_open:    0
                ,    spacing_closed:    0            
                ,    togglerLength_closed:        0
                ,    togglerLength_open:        0
            } 
         });
         */

    /*
    <#if  renderStatus>
        $('div.west_c_s').layout({   
            center:{
                paneSelector:    ".west_c_s_c" 
            }
            ,north:{
                    paneSelector:    ".west_c_s_n"
                ,   size:    20
                ,    spacing_open:    0
                ,    spacing_closed:    0            
                ,    togglerLength_closed:        0
                ,    togglerLength_open:        0
            }    
        });
        </#if>
        */

    /*
    $('div.west_c_c').layout({
        center:{
            paneSelector:    ".west_c_c_c"
        }
        ,north:{
                paneSelector:    ".west_c_c_n"
            ,   size:    20
            ,    spacing_open:    0
            ,    spacing_closed:    0
            ,    togglerLength_closed:        0
            ,    togglerLength_open:        0
        }
    });
    */
}
</script>
<#if list.script??>
<#if !selectedIds??>
<SCRIPT type="text/javascript" src="/PNPMS/${list.script}"></SCRIPT>
</#if>
</#if>                                                                                                                                                                                                                                                                                  